mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 13:25:42 +03:00
parent
7c33c7fc64
commit
98a4fa2b0d
65
.clang-format
Normal file
65
.clang-format
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveMacros: true
|
||||||
|
AlignConsecutiveAssignments: true
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: false
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: true
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeTernaryOperators: false
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
ColumnLimit: 180
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: false
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentWidth: 4
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReflowComments: false
|
||||||
|
SortIncludes: false
|
||||||
|
SortUsingDeclarations: false
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Auto
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
|
||||||
|
BraceWrapping:
|
||||||
|
AfterEnum: false
|
||||||
|
|
||||||
|
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
|
||||||
|
|
||||||
|
NamespaceIndentation: All
|
@ -498,7 +498,8 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
|||||||
// first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter.
|
// first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
||||||
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
||||||
if (wlr_box_contains_point(&box, pos.x, pos.y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden() && !(*w)->m_bPinned)
|
if (wlr_box_contains_point(&box, pos.x, pos.y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden() &&
|
||||||
|
!(*w)->m_bPinned)
|
||||||
return w->get();
|
return w->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,13 +548,15 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
|||||||
if (PMONITOR->specialWorkspaceID) {
|
if (PMONITOR->specialWorkspaceID) {
|
||||||
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
||||||
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
||||||
if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == PMONITOR->specialWorkspaceID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !(*w)->isHidden() && !(*w)->m_bX11ShouldntFocus)
|
if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == PMONITOR->specialWorkspaceID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) &&
|
||||||
|
!(*w)->isHidden() && !(*w)->m_bX11ShouldntFocus)
|
||||||
return (*w).get();
|
return (*w).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
|
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
|
||||||
if (!w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && !w->m_bX11ShouldntFocus)
|
if (!w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() &&
|
||||||
|
!w->m_bX11ShouldntFocus)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,7 +625,8 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
|||||||
}
|
}
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
|
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
|
||||||
if (!w->m_bIsFloating && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() && !w->m_bX11ShouldntFocus)
|
if (!w->m_bIsFloating && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() &&
|
||||||
|
!w->m_bX11ShouldntFocus)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,7 +639,8 @@ CWindow* CCompositor::windowFromCursor() {
|
|||||||
if (PMONITOR->specialWorkspaceID) {
|
if (PMONITOR->specialWorkspaceID) {
|
||||||
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
||||||
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
||||||
if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == PMONITOR->specialWorkspaceID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && !(*w)->isHidden())
|
if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == PMONITOR->specialWorkspaceID && (*w)->m_bIsMapped &&
|
||||||
|
wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && !(*w)->isHidden())
|
||||||
return (*w).get();
|
return (*w).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,7 +661,8 @@ CWindow* CCompositor::windowFromCursor() {
|
|||||||
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
||||||
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
||||||
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->m_bPinned)
|
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) &&
|
||||||
|
!(*w)->m_bPinned)
|
||||||
return w->get();
|
return w->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,7 +684,8 @@ CWindow* CCompositor::windowFloatingFromCursor() {
|
|||||||
|
|
||||||
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
|
||||||
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
||||||
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden() && !(*w)->m_bPinned)
|
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) &&
|
||||||
|
!(*w)->isHidden() && !(*w)->m_bPinned)
|
||||||
return w->get();
|
return w->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,7 +828,8 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
|||||||
|
|
||||||
void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
||||||
|
|
||||||
if (m_sSeat.seat->keyboard_state.focused_surface == pSurface || (pWindowOwner && m_sSeat.seat->keyboard_state.focused_surface == g_pXWaylandManager->getWindowSurface(pWindowOwner)))
|
if (m_sSeat.seat->keyboard_state.focused_surface == pSurface ||
|
||||||
|
(pWindowOwner && m_sSeat.seat->keyboard_state.focused_surface == g_pXWaylandManager->getWindowSurface(pWindowOwner)))
|
||||||
return; // Don't focus when already focused on this.
|
return; // Don't focus when already focused on this.
|
||||||
|
|
||||||
// Unfocus last surface if should
|
// Unfocus last surface if should
|
||||||
@ -835,7 +843,6 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const auto KEYBOARD = wlr_seat_get_keyboard(m_sSeat.seat);
|
const auto KEYBOARD = wlr_seat_get_keyboard(m_sSeat.seat);
|
||||||
|
|
||||||
if (!KEYBOARD)
|
if (!KEYBOARD)
|
||||||
@ -889,7 +896,8 @@ CWindow* CCompositor::getWindowForPopup(wlr_xdg_popup* popup) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<std::unique_ptr<SLayerSurface>>* layerSurfaces, Vector2D* sCoords, SLayerSurface** ppLayerSurfaceFound) {
|
wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<std::unique_ptr<SLayerSurface>>* layerSurfaces, Vector2D* sCoords,
|
||||||
|
SLayerSurface** ppLayerSurfaceFound) {
|
||||||
for (auto it = layerSurfaces->rbegin(); it != layerSurfaces->rend(); it++) {
|
for (auto it = layerSurfaces->rbegin(); it != layerSurfaces->rend(); it++) {
|
||||||
if ((*it)->fadingOut || !(*it)->layerSurface || ((*it)->layerSurface && !(*it)->layerSurface->mapped) || (*it)->alpha.fl() == 0.f)
|
if ((*it)->fadingOut || !(*it)->layerSurface || ((*it)->layerSurface && !(*it)->layerSurface->mapped) || (*it)->alpha.fl() == 0.f)
|
||||||
continue;
|
continue;
|
||||||
@ -1123,7 +1131,7 @@ void CCompositor::cleanupFadingOut(const int& monid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
m_vSurfacesFadingOut.erase(std::remove(m_vSurfacesFadingOut.begin(), m_vSurfacesFadingOut.end(), ls));
|
std::erase(m_vSurfacesFadingOut, ls);
|
||||||
|
|
||||||
Debug::log(LOG, "Fading out a non-existent LS??");
|
Debug::log(LOG, "Fading out a non-existent LS??");
|
||||||
|
|
||||||
@ -1144,12 +1152,12 @@ void CCompositor::cleanupFadingOut(const int& monid) {
|
|||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
for (auto& lsl : m->m_aLayerSurfaceLists) {
|
for (auto& lsl : m->m_aLayerSurfaceLists) {
|
||||||
if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; }) != lsl.end()) {
|
if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; }) != lsl.end()) {
|
||||||
lsl.erase(std::remove_if(lsl.begin(), lsl.end(), [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; }));
|
std::erase_if(lsl, [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_vSurfacesFadingOut.erase(std::remove(m_vSurfacesFadingOut.begin(), m_vSurfacesFadingOut.end(), ls));
|
std::erase(m_vSurfacesFadingOut, ls);
|
||||||
|
|
||||||
Debug::log(LOG, "Cleanup: destroyed a layersurface");
|
Debug::log(LOG, "Cleanup: destroyed a layersurface");
|
||||||
|
|
||||||
@ -1328,9 +1336,7 @@ CWorkspace* CCompositor::getWorkspaceByString(const std::string& str) {
|
|||||||
try {
|
try {
|
||||||
std::string name = "";
|
std::string name = "";
|
||||||
return getWorkspaceByID(getWorkspaceIDFromString(str, name));
|
return getWorkspaceByID(getWorkspaceIDFromString(str, name));
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) { Debug::log(ERR, "Error in getWorkspaceByString, invalid id"); }
|
||||||
Debug::log(ERR, "Error in getWorkspaceByString, invalid id");
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -1456,7 +1462,6 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
|||||||
static auto* const PDIMSTRENGTH = &g_pConfigManager->getConfigValuePtr("decoration:dim_strength")->floatValue;
|
static auto* const PDIMSTRENGTH = &g_pConfigManager->getConfigValuePtr("decoration:dim_strength")->floatValue;
|
||||||
|
|
||||||
auto setBorderColor = [&](CGradientValueData grad) -> void {
|
auto setBorderColor = [&](CGradientValueData grad) -> void {
|
||||||
|
|
||||||
if (grad == pWindow->m_cRealBorderColor)
|
if (grad == pWindow->m_cRealBorderColor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1471,10 +1476,11 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
|||||||
if (RENDERDATA.isBorderColor)
|
if (RENDERDATA.isBorderColor)
|
||||||
setBorderColor(RENDERDATA.borderColor * (1.f / 255.f));
|
setBorderColor(RENDERDATA.borderColor * (1.f / 255.f));
|
||||||
else
|
else
|
||||||
setBorderColor(pWindow == m_pLastWindow ?
|
setBorderColor(
|
||||||
|
pWindow == m_pLastWindow ?
|
||||||
(pWindow->m_sSpecialRenderData.activeBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.activeBorderColor) * (1.f / 255.f)) : *ACTIVECOL) :
|
(pWindow->m_sSpecialRenderData.activeBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.activeBorderColor) * (1.f / 255.f)) : *ACTIVECOL) :
|
||||||
(pWindow->m_sSpecialRenderData.inactiveBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.inactiveBorderColor) * (1.f / 255.f)) : *INACTIVECOL));
|
(pWindow->m_sSpecialRenderData.inactiveBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.inactiveBorderColor) * (1.f / 255.f)) :
|
||||||
|
*INACTIVECOL));
|
||||||
|
|
||||||
// opacity
|
// opacity
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||||
@ -1482,9 +1488,13 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
|||||||
pWindow->m_fActiveInactiveAlpha = *PFULLSCREENALPHA;
|
pWindow->m_fActiveInactiveAlpha = *PFULLSCREENALPHA;
|
||||||
} else {
|
} else {
|
||||||
if (pWindow == m_pLastWindow)
|
if (pWindow == m_pLastWindow)
|
||||||
pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaOverride ? pWindow->m_sSpecialRenderData.alpha : pWindow->m_sSpecialRenderData.alpha * *PACTIVEALPHA;
|
pWindow->m_fActiveInactiveAlpha =
|
||||||
|
pWindow->m_sSpecialRenderData.alphaOverride ? pWindow->m_sSpecialRenderData.alpha : pWindow->m_sSpecialRenderData.alpha * *PACTIVEALPHA;
|
||||||
else
|
else
|
||||||
pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaInactive != -1 ? (pWindow->m_sSpecialRenderData.alphaInactiveOverride ? pWindow->m_sSpecialRenderData.alphaInactive : pWindow->m_sSpecialRenderData.alphaInactive * *PINACTIVEALPHA) : *PINACTIVEALPHA;
|
pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaInactive != -1 ?
|
||||||
|
(pWindow->m_sSpecialRenderData.alphaInactiveOverride ? pWindow->m_sSpecialRenderData.alphaInactive :
|
||||||
|
pWindow->m_sSpecialRenderData.alphaInactive * *PINACTIVEALPHA) :
|
||||||
|
*PINACTIVEALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dim
|
// dim
|
||||||
@ -1683,7 +1693,10 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
|
|||||||
if (nextWorkspaceOnMonitorID == -1) {
|
if (nextWorkspaceOnMonitorID == -1) {
|
||||||
nextWorkspaceOnMonitorID = 1;
|
nextWorkspaceOnMonitorID = 1;
|
||||||
|
|
||||||
while (getWorkspaceByID(nextWorkspaceOnMonitorID) || [&]() -> bool { const auto B = g_pConfigManager->getBoundMonitorForWS(std::to_string(nextWorkspaceOnMonitorID)); return B && B != POLDMON; }())
|
while (getWorkspaceByID(nextWorkspaceOnMonitorID) || [&]() -> bool {
|
||||||
|
const auto B = g_pConfigManager->getBoundMonitorForWS(std::to_string(nextWorkspaceOnMonitorID));
|
||||||
|
return B && B != POLDMON;
|
||||||
|
}())
|
||||||
nextWorkspaceOnMonitorID++;
|
nextWorkspaceOnMonitorID++;
|
||||||
|
|
||||||
Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new %d", nextWorkspaceOnMonitorID);
|
Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new %d", nextWorkspaceOnMonitorID);
|
||||||
@ -1729,7 +1742,8 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
|
|||||||
|
|
||||||
pWorkspace->startAnim(true, true, true);
|
pWorkspace->startAnim(true, true, true);
|
||||||
|
|
||||||
wlr_cursor_warp(m_sWLRCursor, m_sSeat.mouse->mouse, pMonitor->vecPosition.x + pMonitor->vecTransformedSize.x / 2, pMonitor->vecPosition.y + pMonitor->vecTransformedSize.y / 2);
|
wlr_cursor_warp(m_sWLRCursor, m_sSeat.mouse->mouse, pMonitor->vecPosition.x + pMonitor->vecTransformedSize.x / 2,
|
||||||
|
pMonitor->vecPosition.y + pMonitor->vecTransformedSize.y / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// finalize
|
// finalize
|
||||||
@ -1897,8 +1911,7 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
|
|||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return w.get();
|
return w.get();
|
||||||
|
@ -75,7 +75,6 @@ public:
|
|||||||
wlr_backend* m_sWLRHeadlessBackend;
|
wlr_backend* m_sWLRHeadlessBackend;
|
||||||
// ------------------------------------------------- //
|
// ------------------------------------------------- //
|
||||||
|
|
||||||
|
|
||||||
std::string m_szWLDisplaySocket = "";
|
std::string m_szWLDisplaySocket = "";
|
||||||
std::string m_szInstanceSignature = "";
|
std::string m_szInstanceSignature = "";
|
||||||
std::string m_szCurrentSplash = "error";
|
std::string m_szCurrentSplash = "error";
|
||||||
@ -185,12 +184,10 @@ private:
|
|||||||
uint64_t m_iHyprlandPID = 0;
|
uint64_t m_iHyprlandPID = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline std::unique_ptr<CCompositor> g_pCompositor;
|
inline std::unique_ptr<CCompositor> g_pCompositor;
|
||||||
|
|
||||||
// For XWayland
|
// For XWayland
|
||||||
inline std::map<std::string, xcb_atom_t> HYPRATOMS = {
|
inline std::map<std::string, xcb_atom_t> HYPRATOMS = {HYPRATOM("_NET_WM_WINDOW_TYPE"),
|
||||||
HYPRATOM("_NET_WM_WINDOW_TYPE"),
|
|
||||||
HYPRATOM("_NET_WM_WINDOW_TYPE_NORMAL"),
|
HYPRATOM("_NET_WM_WINDOW_TYPE_NORMAL"),
|
||||||
HYPRATOM("_NET_WM_WINDOW_TYPE_DOCK"),
|
HYPRATOM("_NET_WM_WINDOW_TYPE_DOCK"),
|
||||||
HYPRATOM("_NET_WM_WINDOW_TYPE_DIALOG"),
|
HYPRATOM("_NET_WM_WINDOW_TYPE_DIALOG"),
|
||||||
|
@ -44,10 +44,8 @@ wlr_box CWindow::getFullWindowBoundingBox() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add extents to the real base BB and return
|
// Add extents to the real base BB and return
|
||||||
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x,
|
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y,
|
||||||
m_vRealPosition.vec().y - maxExtents.topLeft.y,
|
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
|
||||||
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x,
|
|
||||||
m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
|
|
||||||
|
|
||||||
return finalBox;
|
return finalBox;
|
||||||
}
|
}
|
||||||
@ -135,25 +133,28 @@ void CWindow::createToplevelHandle() {
|
|||||||
wlr_foreign_toplevel_handle_v1_set_fullscreen(m_phForeignToplevel, false);
|
wlr_foreign_toplevel_handle_v1_set_fullscreen(m_phForeignToplevel, false);
|
||||||
|
|
||||||
// handle events
|
// handle events
|
||||||
hyprListener_toplevelActivate.initCallback(&m_phForeignToplevel->events.request_activate, [&](void* owner, void* data) {
|
hyprListener_toplevelActivate.initCallback(
|
||||||
|
&m_phForeignToplevel->events.request_activate,
|
||||||
|
[&](void* owner, void* data) {
|
||||||
g_pCompositor->focusWindow(this);
|
g_pCompositor->focusWindow(this);
|
||||||
|
},
|
||||||
|
this, "Toplevel");
|
||||||
|
|
||||||
}, this, "Toplevel");
|
hyprListener_toplevelFullscreen.initCallback(
|
||||||
|
&m_phForeignToplevel->events.request_fullscreen,
|
||||||
hyprListener_toplevelFullscreen.initCallback(&m_phForeignToplevel->events.request_fullscreen, [&](void* owner, void* data) {
|
[&](void* owner, void* data) {
|
||||||
|
|
||||||
const auto EV = (wlr_foreign_toplevel_handle_v1_fullscreen_event*)data;
|
const auto EV = (wlr_foreign_toplevel_handle_v1_fullscreen_event*)data;
|
||||||
|
|
||||||
g_pCompositor->setWindowFullscreen(this, EV->fullscreen, FULLSCREEN_FULL);
|
g_pCompositor->setWindowFullscreen(this, EV->fullscreen, FULLSCREEN_FULL);
|
||||||
|
},
|
||||||
|
this, "Toplevel");
|
||||||
|
|
||||||
}, this, "Toplevel");
|
hyprListener_toplevelClose.initCallback(
|
||||||
|
&m_phForeignToplevel->events.request_close,
|
||||||
hyprListener_toplevelClose.initCallback(&m_phForeignToplevel->events.request_close, [&](void* owner, void* data) {
|
[&](void* owner, void* data) {
|
||||||
|
|
||||||
g_pCompositor->closeWindow(this);
|
g_pCompositor->closeWindow(this);
|
||||||
|
},
|
||||||
}, this, "Toplevel");
|
this, "Toplevel");
|
||||||
|
|
||||||
m_iLastToplevelMonitorID = m_iMonitorID;
|
m_iLastToplevelMonitorID = m_iMonitorID;
|
||||||
}
|
}
|
||||||
@ -290,12 +291,8 @@ void CWindow::onMap() {
|
|||||||
m_cRealShadowColor.registerVar();
|
m_cRealShadowColor.registerVar();
|
||||||
m_fDimPercent.registerVar();
|
m_fDimPercent.registerVar();
|
||||||
|
|
||||||
m_vRealSize.setCallbackOnEnd([&] (void* ptr) {
|
m_vRealSize.setCallbackOnEnd([&](void* ptr) { g_pHyprOpenGL->onWindowResizeEnd(this); }, false);
|
||||||
g_pHyprOpenGL->onWindowResizeEnd(this);
|
m_vRealSize.setCallbackOnBegin([&](void* ptr) { g_pHyprOpenGL->onWindowResizeStart(this); }, false);
|
||||||
}, false);
|
|
||||||
m_vRealSize.setCallbackOnBegin([&] (void* ptr) {
|
|
||||||
g_pHyprOpenGL->onWindowResizeStart(this);
|
|
||||||
}, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::setHidden(bool hidden) {
|
void CWindow::setHidden(bool hidden) {
|
||||||
@ -323,9 +320,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
|||||||
} else if (r.szRule.find("rounding") == 0) {
|
} else if (r.szRule.find("rounding") == 0) {
|
||||||
try {
|
try {
|
||||||
m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) { Debug::log(ERR, "Rounding rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
|
||||||
Debug::log(ERR, "Rounding rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
|
|
||||||
}
|
|
||||||
} else if (r.szRule.find("opacity") == 0) {
|
} else if (r.szRule.find("opacity") == 0) {
|
||||||
try {
|
try {
|
||||||
CVarList vars(r.szRule, 0, ' ');
|
CVarList vars(r.szRule, 0, ' ');
|
||||||
@ -346,9 +341,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(std::exception& e) {
|
} catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
|
||||||
Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
|
|
||||||
}
|
|
||||||
} else if (r.szRule == "noanim") {
|
} else if (r.szRule == "noanim") {
|
||||||
m_sAdditionalConfigData.forceNoAnims = true;
|
m_sAdditionalConfigData.forceNoAnims = true;
|
||||||
} else if (r.szRule.find("animation") == 0) {
|
} else if (r.szRule.find("animation") == 0) {
|
||||||
@ -365,9 +358,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
|||||||
} else {
|
} else {
|
||||||
m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart);
|
m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart);
|
||||||
}
|
}
|
||||||
} catch(std::exception& e) {
|
} catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
|
||||||
Debug::log(ERR, "BorderColor rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include "config/ConfigDataValues.hpp"
|
#include "config/ConfigDataValues.hpp"
|
||||||
|
|
||||||
enum eIdleInhibitMode {
|
enum eIdleInhibitMode
|
||||||
|
{
|
||||||
IDLEINHIBIT_NONE = 0,
|
IDLEINHIBIT_NONE = 0,
|
||||||
IDLEINHIBIT_ALWAYS,
|
IDLEINHIBIT_ALWAYS,
|
||||||
IDLEINHIBIT_FULLSCREEN,
|
IDLEINHIBIT_FULLSCREEN,
|
||||||
@ -190,7 +191,8 @@ public:
|
|||||||
|
|
||||||
// For the list lookup
|
// For the list lookup
|
||||||
bool operator==(const CWindow& rhs) {
|
bool operator==(const CWindow& rhs) {
|
||||||
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && m_bFadingOut == rhs.m_bFadingOut;
|
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize &&
|
||||||
|
m_bFadingOut == rhs.m_bFadingOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
@ -216,5 +218,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
// For hidden windows and stuff
|
// For hidden windows and stuff
|
||||||
bool m_bHidden = false;
|
bool m_bHidden = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
enum eConfigValueDataTypes {
|
enum eConfigValueDataTypes
|
||||||
|
{
|
||||||
CVD_TYPE_INVALID = -1,
|
CVD_TYPE_INVALID = -1,
|
||||||
CVD_TYPE_GRADIENT = 0
|
CVD_TYPE_GRADIENT = 0
|
||||||
};
|
};
|
||||||
@ -41,7 +43,8 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (size_t i = 0; i < m_vColors.size(); ++i)
|
for (size_t i = 0; i < m_vColors.size(); ++i)
|
||||||
if (m_vColors[i] != other.m_vColors[i]) return false;
|
if (m_vColors[i] != other.m_vColors[i])
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -233,15 +233,7 @@ void CConfigManager::setDefaultAnimationVars() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// init the values
|
// init the values
|
||||||
animationConfig["global"] = {
|
animationConfig["global"] = {false, "default", "", 8.f, 1, &animationConfig["general"], nullptr};
|
||||||
false,
|
|
||||||
"default",
|
|
||||||
"",
|
|
||||||
8.f,
|
|
||||||
1,
|
|
||||||
&animationConfig["general"],
|
|
||||||
nullptr
|
|
||||||
};
|
|
||||||
|
|
||||||
CREATEANIMCFG("windows", "global");
|
CREATEANIMCFG("windows", "global");
|
||||||
CREATEANIMCFG("fade", "global");
|
CREATEANIMCFG("fade", "global");
|
||||||
@ -470,8 +462,7 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }) != m_dMonitorRules.end())
|
std::erase_if(m_dMonitorRules, [&](const auto& other) { return other.name == newrule.name; });
|
||||||
m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }));
|
|
||||||
|
|
||||||
m_dMonitorRules.push_back(newrule);
|
m_dMonitorRules.push_back(newrule);
|
||||||
|
|
||||||
@ -533,8 +524,7 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
|
|||||||
argno++;
|
argno++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }) != m_dMonitorRules.end())
|
std::erase_if(m_dMonitorRules, [&](const auto& other) { return other.name == newrule.name; });
|
||||||
m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }));
|
|
||||||
|
|
||||||
m_dMonitorRules.push_back(newrule);
|
m_dMonitorRules.push_back(newrule);
|
||||||
}
|
}
|
||||||
@ -736,38 +726,16 @@ void CConfigManager::handleUnbind(const std::string& command, const std::string&
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool windowRuleValid(const std::string& RULE) {
|
bool windowRuleValid(const std::string& RULE) {
|
||||||
return !(RULE != "float"
|
return !(RULE != "float" && RULE != "tile" && RULE.find("opacity") != 0 && RULE.find("move") != 0 && RULE.find("size") != 0 && RULE.find("minsize") != 0 &&
|
||||||
&& RULE != "tile"
|
RULE.find("maxsize") != 0 && RULE.find("pseudo") != 0 && RULE.find("monitor") != 0 && RULE.find("idleinhibit") != 0 && RULE != "nofocus" && RULE != "noblur" &&
|
||||||
&& RULE.find("opacity") != 0
|
RULE != "noshadow" && RULE != "noborder" && RULE != "center" && RULE != "opaque" && RULE != "forceinput" && RULE != "fullscreen" && RULE != "nofullscreenrequest" &&
|
||||||
&& RULE.find("move") != 0
|
RULE != "nomaxsize" && RULE != "pin" && RULE != "noanim" && RULE != "windowdance" && RULE.find("animation") != 0 && RULE.find("rounding") != 0 &&
|
||||||
&& RULE.find("size") != 0
|
RULE.find("workspace") != 0 && RULE.find("bordercolor") != 0);
|
||||||
&& RULE.find("minsize") != 0
|
|
||||||
&& RULE.find("maxsize") != 0
|
|
||||||
&& RULE.find("pseudo") != 0
|
|
||||||
&& RULE.find("monitor") != 0
|
|
||||||
&& RULE.find("idleinhibit") != 0
|
|
||||||
&& RULE != "nofocus"
|
|
||||||
&& RULE != "noblur"
|
|
||||||
&& RULE != "noshadow"
|
|
||||||
&& RULE != "noborder"
|
|
||||||
&& RULE != "center"
|
|
||||||
&& RULE != "opaque"
|
|
||||||
&& RULE != "forceinput"
|
|
||||||
&& RULE != "fullscreen"
|
|
||||||
&& RULE != "nofullscreenrequest"
|
|
||||||
&& RULE != "nomaxsize"
|
|
||||||
&& RULE != "pin"
|
|
||||||
&& RULE != "noanim"
|
|
||||||
&& RULE != "windowdance"
|
|
||||||
&& RULE.find("animation") != 0
|
|
||||||
&& RULE.find("rounding") != 0
|
|
||||||
&& RULE.find("workspace") != 0
|
|
||||||
&& RULE.find("bordercolor") != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::handleWindowRule(const std::string& command, const std::string& value) {
|
void CConfigManager::handleWindowRule(const std::string& command, const std::string& value) {
|
||||||
const auto RULE = removeBeginEndSpacesTabs(value.substr(0, value.find_first_of(",")));
|
const auto RULE = removeBeginEndSpacesTabs(value.substr(0, value.find_first_of(',')));
|
||||||
const auto VALUE = removeBeginEndSpacesTabs(value.substr(value.find_first_of(",") + 1));
|
const auto VALUE = removeBeginEndSpacesTabs(value.substr(value.find_first_of(',') + 1));
|
||||||
|
|
||||||
// check rule and value
|
// check rule and value
|
||||||
if (RULE == "" || VALUE == "") {
|
if (RULE == "" || VALUE == "") {
|
||||||
@ -775,9 +743,7 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (RULE == "unset") {
|
if (RULE == "unset") {
|
||||||
std::erase_if(m_dWindowRules, [&] (const SWindowRule& other) {
|
std::erase_if(m_dWindowRules, [&](const SWindowRule& other) { return other.szValue == VALUE; });
|
||||||
return other.szValue == VALUE;
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,8 +758,8 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::handleWindowRuleV2(const std::string& command, const std::string& value) {
|
void CConfigManager::handleWindowRuleV2(const std::string& command, const std::string& value) {
|
||||||
const auto RULE = value.substr(0, value.find_first_of(","));
|
const auto RULE = value.substr(0, value.find_first_of(','));
|
||||||
const auto VALUE = value.substr(value.find_first_of(",") + 1);
|
const auto VALUE = value.substr(value.find_first_of(',') + 1);
|
||||||
|
|
||||||
if (!windowRuleValid(RULE) && RULE != "unset") {
|
if (!windowRuleValid(RULE) && RULE != "unset") {
|
||||||
Debug::log(ERR, "Invalid rulev2 found: %s", RULE.c_str());
|
Debug::log(ERR, "Invalid rulev2 found: %s", RULE.c_str());
|
||||||
@ -814,9 +780,8 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s
|
|||||||
const auto FULLSCREENPOS = VALUE.find("fullscreen:");
|
const auto FULLSCREENPOS = VALUE.find("fullscreen:");
|
||||||
const auto PINNEDPOS = VALUE.find("pinned:");
|
const auto PINNEDPOS = VALUE.find("pinned:");
|
||||||
|
|
||||||
if (TITLEPOS == std::string::npos && CLASSPOS == std::string::npos &&
|
if (TITLEPOS == std::string::npos && CLASSPOS == std::string::npos && X11POS == std::string::npos && FLOATPOS == std::string::npos && FULLSCREENPOS == std::string::npos &&
|
||||||
X11POS == std::string::npos && FLOATPOS == std::string::npos &&
|
PINNEDPOS == std::string::npos) {
|
||||||
FULLSCREENPOS == std::string::npos && PINNEDPOS == std::string::npos) {
|
|
||||||
Debug::log(ERR, "Invalid rulev2 syntax: %s", VALUE.c_str());
|
Debug::log(ERR, "Invalid rulev2 syntax: %s", VALUE.c_str());
|
||||||
parseError = "Invalid rulev2 syntax: " + VALUE;
|
parseError = "Invalid rulev2 syntax: " + VALUE;
|
||||||
return;
|
return;
|
||||||
@ -827,12 +792,18 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s
|
|||||||
result = VALUE.substr(pos);
|
result = VALUE.substr(pos);
|
||||||
|
|
||||||
size_t min = 999999;
|
size_t min = 999999;
|
||||||
if (TITLEPOS > pos && TITLEPOS < min) min = TITLEPOS;
|
if (TITLEPOS > pos && TITLEPOS < min)
|
||||||
if (CLASSPOS > pos && CLASSPOS < min) min = CLASSPOS;
|
min = TITLEPOS;
|
||||||
if (X11POS > pos && X11POS < min) min = X11POS;
|
if (CLASSPOS > pos && CLASSPOS < min)
|
||||||
if (FLOATPOS > pos && FLOATPOS < min) min = FLOATPOS;
|
min = CLASSPOS;
|
||||||
if (FULLSCREENPOS > pos && FULLSCREENPOS < min) min = FULLSCREENPOS;
|
if (X11POS > pos && X11POS < min)
|
||||||
if (PINNEDPOS > pos && PINNEDPOS < min) min = PINNEDPOS;
|
min = X11POS;
|
||||||
|
if (FLOATPOS > pos && FLOATPOS < min)
|
||||||
|
min = FLOATPOS;
|
||||||
|
if (FULLSCREENPOS > pos && FULLSCREENPOS < min)
|
||||||
|
min = FULLSCREENPOS;
|
||||||
|
if (PINNEDPOS > pos && PINNEDPOS < min)
|
||||||
|
min = PINNEDPOS;
|
||||||
|
|
||||||
result = result.substr(0, min - pos);
|
result = result.substr(0, min - pos);
|
||||||
|
|
||||||
@ -1019,19 +990,30 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
|
|||||||
if (isFirstLaunch) {
|
if (isFirstLaunch) {
|
||||||
firstExecRequests.push_back(VALUE);
|
firstExecRequests.push_back(VALUE);
|
||||||
}
|
}
|
||||||
}
|
} else if (COMMAND == "monitor")
|
||||||
else if (COMMAND == "monitor") handleMonitor(COMMAND, VALUE);
|
handleMonitor(COMMAND, VALUE);
|
||||||
else if (COMMAND.find("bind") == 0) handleBind(COMMAND, VALUE);
|
else if (COMMAND.find("bind") == 0)
|
||||||
else if (COMMAND == "unbind") handleUnbind(COMMAND, VALUE);
|
handleBind(COMMAND, VALUE);
|
||||||
else if (COMMAND == "workspace") handleDefaultWorkspace(COMMAND, VALUE);
|
else if (COMMAND == "unbind")
|
||||||
else if (COMMAND == "windowrule") handleWindowRule(COMMAND, VALUE);
|
handleUnbind(COMMAND, VALUE);
|
||||||
else if (COMMAND == "windowrulev2") handleWindowRuleV2(COMMAND, VALUE);
|
else if (COMMAND == "workspace")
|
||||||
else if (COMMAND == "bezier") handleBezier(COMMAND, VALUE);
|
handleDefaultWorkspace(COMMAND, VALUE);
|
||||||
else if (COMMAND == "animation") handleAnimation(COMMAND, VALUE);
|
else if (COMMAND == "windowrule")
|
||||||
else if (COMMAND == "source") handleSource(COMMAND, VALUE);
|
handleWindowRule(COMMAND, VALUE);
|
||||||
else if (COMMAND == "submap") handleSubmap(COMMAND, VALUE);
|
else if (COMMAND == "windowrulev2")
|
||||||
else if (COMMAND == "blurls") handleBlurLS(COMMAND, VALUE);
|
handleWindowRuleV2(COMMAND, VALUE);
|
||||||
else if (COMMAND == "wsbind") handleBindWS(COMMAND, VALUE);
|
else if (COMMAND == "bezier")
|
||||||
|
handleBezier(COMMAND, VALUE);
|
||||||
|
else if (COMMAND == "animation")
|
||||||
|
handleAnimation(COMMAND, VALUE);
|
||||||
|
else if (COMMAND == "source")
|
||||||
|
handleSource(COMMAND, VALUE);
|
||||||
|
else if (COMMAND == "submap")
|
||||||
|
handleSubmap(COMMAND, VALUE);
|
||||||
|
else if (COMMAND == "blurls")
|
||||||
|
handleBlurLS(COMMAND, VALUE);
|
||||||
|
else if (COMMAND == "wsbind")
|
||||||
|
handleBindWS(COMMAND, VALUE);
|
||||||
else {
|
else {
|
||||||
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
|
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
|
||||||
needsLayoutRecalc = 2;
|
needsLayoutRecalc = 2;
|
||||||
@ -1110,8 +1092,7 @@ void CConfigManager::parseLine(std::string& line) {
|
|||||||
if (currentCategory.length() != 0) {
|
if (currentCategory.length() != 0) {
|
||||||
currentCategory.push_back(':');
|
currentCategory.push_back(':');
|
||||||
currentCategory.append(cat);
|
currentCategory.append(cat);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
currentCategory = cat;
|
currentCategory = cat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1189,13 +1170,13 @@ void CConfigManager::loadConfigLoadVars() {
|
|||||||
Debug::log(WARN, "Config reading error. (No file? Attempting to generate, backing up old one if exists)");
|
Debug::log(WARN, "Config reading error. (No file? Attempting to generate, backing up old one if exists)");
|
||||||
try {
|
try {
|
||||||
std::filesystem::rename(CONFIGPATH, CONFIGPATH + ".backup");
|
std::filesystem::rename(CONFIGPATH, CONFIGPATH + ".backup");
|
||||||
} catch(...) { /* Probably doesn't exist */}
|
} catch (...) { /* Probably doesn't exist */
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!std::filesystem::is_directory(CONFIGPARENTPATH))
|
if (!std::filesystem::is_directory(CONFIGPARENTPATH))
|
||||||
std::filesystem::create_directories(CONFIGPARENTPATH);
|
std::filesystem::create_directories(CONFIGPARENTPATH);
|
||||||
}
|
} catch (...) {
|
||||||
catch (...) {
|
|
||||||
parseError = "Broken config file! (Could not create directory)";
|
parseError = "Broken config file! (Could not create directory)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1261,7 +1242,8 @@ void CConfigManager::loadConfigLoadVars() {
|
|||||||
if (parseError != "")
|
if (parseError != "")
|
||||||
g_pHyprError->queueCreate(parseError + "\nHyprland may not work correctly.", CColor(255, 50, 50, 255));
|
g_pHyprError->queueCreate(parseError + "\nHyprland may not work correctly.", CColor(255, 50, 50, 255));
|
||||||
else if (configValues["autogenerated"].intValue == 1)
|
else if (configValues["autogenerated"].intValue == 1)
|
||||||
g_pHyprError->queueCreate("Warning: You're using an autogenerated config! (config file: " + CONFIGPATH + " )\nSUPER+Q -> kitty\nSUPER+M -> exit Hyprland", CColor(255, 255, 70, 255));
|
g_pHyprError->queueCreate("Warning: You're using an autogenerated config! (config file: " + CONFIGPATH + " )\nSUPER+Q -> kitty\nSUPER+M -> exit Hyprland",
|
||||||
|
CColor(255, 255, 70, 255));
|
||||||
else
|
else
|
||||||
g_pHyprError->destroy();
|
g_pHyprError->destroy();
|
||||||
|
|
||||||
@ -1374,7 +1356,7 @@ float CConfigManager::getFloat(const std::string& v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CConfigManager::getString(const std::string& v) {
|
std::string CConfigManager::getString(const std::string& v) {
|
||||||
const auto VAL = getConfigValueSafe(v).strValue;
|
auto VAL = getConfigValueSafe(v).strValue;
|
||||||
|
|
||||||
if (VAL == STRVAL_EMPTY)
|
if (VAL == STRVAL_EMPTY)
|
||||||
return "";
|
return "";
|
||||||
@ -1391,7 +1373,7 @@ float CConfigManager::getDeviceFloat(const std::string& dev, const std::string&
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CConfigManager::getDeviceString(const std::string& dev, const std::string& v) {
|
std::string CConfigManager::getDeviceString(const std::string& dev, const std::string& v) {
|
||||||
const auto VAL = getConfigValueSafeDevice(dev, v).strValue;
|
auto VAL = getConfigValueSafeDevice(dev, v).strValue;
|
||||||
|
|
||||||
if (VAL == STRVAL_EMPTY)
|
if (VAL == STRVAL_EMPTY)
|
||||||
return "";
|
return "";
|
||||||
@ -1399,23 +1381,25 @@ std::string CConfigManager::getDeviceString(const std::string& dev, const std::s
|
|||||||
return VAL;
|
return VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::setInt(std::string v, int val) {
|
void CConfigManager::setInt(const std::string& v, int val) {
|
||||||
configValues[v].intValue = val;
|
configValues[v].intValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::setFloat(std::string v, float val) {
|
void CConfigManager::setFloat(const std::string& v, float val) {
|
||||||
configValues[v].floatValue = val;
|
configValues[v].floatValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::setString(std::string v, std::string val) {
|
void CConfigManager::setString(const std::string& v, const std::string& val) {
|
||||||
configValues[v].strValue = val;
|
configValues[v].strValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitorRule CConfigManager::getMonitorRuleFor(std::string name, std::string displayName) {
|
SMonitorRule CConfigManager::getMonitorRuleFor(const std::string& name, const std::string& displayName) {
|
||||||
SMonitorRule* found = nullptr;
|
SMonitorRule* found = nullptr;
|
||||||
|
|
||||||
for (auto& r : m_dMonitorRules) {
|
for (auto& r : m_dMonitorRules) {
|
||||||
if (r.name == name || (r.name.find("desc:") == 0 && (r.name.substr(5) == displayName || r.name.substr(5) == removeBeginEndSpacesTabs(displayName.substr(0, displayName.find_first_of('(')))))) {
|
if (r.name == name ||
|
||||||
|
(r.name.find("desc:") == 0 &&
|
||||||
|
(r.name.substr(5) == displayName || r.name.substr(5) == removeBeginEndSpacesTabs(displayName.substr(0, displayName.find_first_of('(')))))) {
|
||||||
found = &r;
|
found = &r;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1585,11 +1569,11 @@ void CConfigManager::performMonitorReload() {
|
|||||||
m_bWantsMonitorReload = false;
|
m_bWantsMonitorReload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SConfigValue* CConfigManager::getConfigValuePtr(std::string val) {
|
SConfigValue* CConfigManager::getConfigValuePtr(const std::string& val) {
|
||||||
return &configValues[val];
|
return &configValues[val];
|
||||||
}
|
}
|
||||||
|
|
||||||
SConfigValue* CConfigManager::getConfigValuePtrSafe(std::string val) {
|
SConfigValue* CConfigManager::getConfigValuePtrSafe(const std::string& val) {
|
||||||
const auto IT = configValues.find(val);
|
const auto IT = configValues.find(val);
|
||||||
|
|
||||||
if (IT == configValues.end())
|
if (IT == configValues.end())
|
||||||
@ -1682,7 +1666,7 @@ void CConfigManager::addParseError(const std::string& err) {
|
|||||||
g_pHyprError->queueCreate(parseError + "\nHyprland may not work correctly.", CColor(255, 50, 50, 255));
|
g_pHyprError->queueCreate(parseError + "\nHyprland may not work correctly.", CColor(255, 50, 50, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CConfigManager::getBoundMonitorForWS(std::string wsname) {
|
CMonitor* CConfigManager::getBoundMonitorForWS(const std::string& wsname) {
|
||||||
for (auto& [ws, mon] : boundWorkspaces) {
|
for (auto& [ws, mon] : boundWorkspaces) {
|
||||||
const auto WSNAME = ws.find("name:") == 0 ? ws.substr(5) : ws;
|
const auto WSNAME = ws.find("name:") == 0 ? ws.substr(5) : ws;
|
||||||
|
|
||||||
@ -1694,7 +1678,7 @@ CMonitor* CConfigManager::getBoundMonitorForWS(std::string wsname) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CConfigManager::getBoundMonitorStringForWS(std::string wsname) {
|
std::string CConfigManager::getBoundMonitorStringForWS(const std::string& wsname) {
|
||||||
for (auto& [ws, mon] : boundWorkspaces) {
|
for (auto& [ws, mon] : boundWorkspaces) {
|
||||||
const auto WSNAME = ws.find("name:") == 0 ? ws.substr(5) : ws;
|
const auto WSNAME = ws.find("name:") == 0 ? ws.substr(5) : ws;
|
||||||
|
|
||||||
@ -1706,7 +1690,7 @@ std::string CConfigManager::getBoundMonitorStringForWS(std::string wsname) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::addExecRule(SExecRequestedRule rule) {
|
void CConfigManager::addExecRule(const SExecRequestedRule& rule) {
|
||||||
execRequestedRules.push_back(rule);
|
execRequestedRules.push_back(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,10 +106,18 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for range-based loops
|
// for range-based loops
|
||||||
std::vector<std::string>::iterator begin() { return m_vArgs.begin(); }
|
std::vector<std::string>::iterator begin() {
|
||||||
std::vector<std::string>::const_iterator begin() const { return m_vArgs.begin(); }
|
return m_vArgs.begin();
|
||||||
std::vector<std::string>::iterator end() { return m_vArgs.end(); }
|
}
|
||||||
std::vector<std::string>::const_iterator end() const { return m_vArgs.end(); }
|
std::vector<std::string>::const_iterator begin() const {
|
||||||
|
return m_vArgs.begin();
|
||||||
|
}
|
||||||
|
std::vector<std::string>::iterator end() {
|
||||||
|
return m_vArgs.end();
|
||||||
|
}
|
||||||
|
std::vector<std::string>::const_iterator end() const {
|
||||||
|
return m_vArgs.end();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> m_vArgs;
|
std::vector<std::string> m_vArgs;
|
||||||
@ -125,9 +133,9 @@ public:
|
|||||||
int getInt(const std::string&);
|
int getInt(const std::string&);
|
||||||
float getFloat(const std::string&);
|
float getFloat(const std::string&);
|
||||||
std::string getString(const std::string&);
|
std::string getString(const std::string&);
|
||||||
void setFloat(std::string, float);
|
void setFloat(const std::string&, float);
|
||||||
void setInt(std::string, int);
|
void setInt(const std::string&, int);
|
||||||
void setString(std::string, std::string);
|
void setString(const std::string&, const std::string&);
|
||||||
|
|
||||||
int getDeviceInt(const std::string&, const std::string&);
|
int getDeviceInt(const std::string&, const std::string&);
|
||||||
float getDeviceFloat(const std::string&, const std::string&);
|
float getDeviceFloat(const std::string&, const std::string&);
|
||||||
@ -135,13 +143,13 @@ public:
|
|||||||
bool deviceConfigExists(const std::string&);
|
bool deviceConfigExists(const std::string&);
|
||||||
bool shouldBlurLS(const std::string&);
|
bool shouldBlurLS(const std::string&);
|
||||||
|
|
||||||
SConfigValue* getConfigValuePtr(std::string);
|
SConfigValue* getConfigValuePtr(const std::string&);
|
||||||
SConfigValue* getConfigValuePtrSafe(std::string);
|
SConfigValue* getConfigValuePtrSafe(const std::string&);
|
||||||
|
|
||||||
SMonitorRule getMonitorRuleFor(std::string, std::string displayName = "");
|
SMonitorRule getMonitorRuleFor(const std::string&, const std::string& displayName = "");
|
||||||
|
|
||||||
CMonitor* getBoundMonitorForWS(std::string);
|
CMonitor* getBoundMonitorForWS(const std::string&);
|
||||||
std::string getBoundMonitorStringForWS(std::string);
|
std::string getBoundMonitorStringForWS(const std::string&);
|
||||||
|
|
||||||
std::vector<SWindowRule> getMatchingRules(CWindow*);
|
std::vector<SWindowRule> getMatchingRules(CWindow*);
|
||||||
|
|
||||||
@ -163,7 +171,7 @@ public:
|
|||||||
|
|
||||||
SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&);
|
SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&);
|
||||||
|
|
||||||
void addExecRule(SExecRequestedRule);
|
void addExecRule(const SExecRequestedRule&);
|
||||||
|
|
||||||
std::string configCurrentPath;
|
std::string configCurrentPath;
|
||||||
|
|
||||||
|
@ -39,19 +39,11 @@ R"#({
|
|||||||
"focused": %s,
|
"focused": %s,
|
||||||
"dpmsStatus": %s
|
"dpmsStatus": %s
|
||||||
},)#",
|
},)#",
|
||||||
m->ID,
|
m->ID, escapeJSONStrings(m->szName).c_str(), escapeJSONStrings(m->output->description ? m->output->description : "").c_str(), (int)m->vecPixelSize.x,
|
||||||
escapeJSONStrings(m->szName).c_str(),
|
(int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspace,
|
||||||
escapeJSONStrings(m->output->description ? m->output->description : "").c_str(),
|
escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName).c_str(), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y,
|
||||||
(int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
|
(int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"),
|
||||||
m->refreshRate,
|
(m->dpmsStatus ? "true" : "false"));
|
||||||
(int)m->vecPosition.x, (int)m->vecPosition.y,
|
|
||||||
m->activeWorkspace, escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName).c_str(),
|
|
||||||
(int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y,
|
|
||||||
m->scale,
|
|
||||||
(int)m->transform,
|
|
||||||
(m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"),
|
|
||||||
(m->dpmsStatus ? "true" : "false")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -60,8 +52,12 @@ R"#({
|
|||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tdescription: %s\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: %i\n\tfocused: %s\n\tdpmsStatus: %i\n\n",
|
result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tdescription: %s\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: "
|
||||||
m->szName.c_str(), m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, (m->output->description ? m->output->description : ""), m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus);
|
"%i\n\tfocused: %s\n\tdpmsStatus: %i\n\n",
|
||||||
|
m->szName.c_str(), m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y,
|
||||||
|
(m->output->description ? m->output->description : ""), m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(),
|
||||||
|
(int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale,
|
||||||
|
(int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,25 +115,29 @@ R"#({
|
|||||||
"grouped": [%s],
|
"grouped": [%s],
|
||||||
"swallowing": %s
|
"swallowing": %s
|
||||||
},)#",
|
},)#",
|
||||||
w,
|
w, (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y, w->m_iWorkspaceID,
|
||||||
(int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y,
|
escapeJSONStrings(w->m_iWorkspaceID == -1 ? "" :
|
||||||
(int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y,
|
g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName :
|
||||||
w->m_iWorkspaceID, escapeJSONStrings(w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID))).c_str(),
|
std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)))
|
||||||
((int)w->m_bIsFloating == 1 ? "true" : "false"),
|
.c_str(),
|
||||||
w->m_iMonitorID,
|
((int)w->m_bIsFloating == 1 ? "true" : "false"), w->m_iMonitorID, escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)).c_str(),
|
||||||
escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)).c_str(),
|
escapeJSONStrings(g_pXWaylandManager->getTitle(w)).c_str(), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
|
||||||
escapeJSONStrings(g_pXWaylandManager->getTitle(w)).c_str(),
|
|
||||||
w->getPID(),
|
|
||||||
((int)w->m_bIsX11 == 1 ? "true" : "false"),
|
|
||||||
(w->m_bPinned ? "true" : "false"),
|
|
||||||
(w->m_bIsFullscreen ? "true" : "false"),
|
(w->m_bIsFullscreen ? "true" : "false"),
|
||||||
(w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
|
(w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
|
||||||
getGroupedData(w, format).c_str(),
|
getGroupedData(w, format).c_str(), (w->m_pSwallowed ? getFormat("\"0x%x\"", w->m_pSwallowed).c_str() : "null"));
|
||||||
(w->m_pSwallowed ? getFormat("\"0x%x\"", w->m_pSwallowed).c_str() : "null")
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\tpinned: %i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\tgrouped: %s\n\tswallowing: %x\n\n",
|
return getFormat(
|
||||||
w, w->m_szTitle.c_str(), (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y, w->m_iWorkspaceID, (w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()), (int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w).c_str(), g_pXWaylandManager->getTitle(w).c_str(), w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen, (w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0), getGroupedData(w, format).c_str(), w->m_pSwallowed);
|
"Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\tpinned: "
|
||||||
|
"%i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\tgrouped: %s\n\tswallowing: %x\n\n",
|
||||||
|
w, w->m_szTitle.c_str(), (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y,
|
||||||
|
w->m_iWorkspaceID,
|
||||||
|
(w->m_iWorkspaceID == -1 ? "" :
|
||||||
|
g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() :
|
||||||
|
std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()),
|
||||||
|
(int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w).c_str(), g_pXWaylandManager->getTitle(w).c_str(), w->getPID(), (int)w->m_bIsX11,
|
||||||
|
(int)w->m_bPinned, (int)w->m_bIsFullscreen,
|
||||||
|
(w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
|
||||||
|
getGroupedData(w, format).c_str(), w->m_pSwallowed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,14 +185,9 @@ R"#({
|
|||||||
"lastwindow": "0x%x",
|
"lastwindow": "0x%x",
|
||||||
"lastwindowtitle": "%s"
|
"lastwindowtitle": "%s"
|
||||||
},)#",
|
},)#",
|
||||||
w->m_iID,
|
w->m_iID, escapeJSONStrings(w->m_szName).c_str(), escapeJSONStrings(g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName).c_str(),
|
||||||
escapeJSONStrings(w->m_szName).c_str(),
|
g_pCompositor->getWindowsOnWorkspace(w->m_iID), ((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"), PLASTW,
|
||||||
escapeJSONStrings(g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName).c_str(),
|
PLASTW ? escapeJSONStrings(PLASTW->m_szTitle).c_str() : "");
|
||||||
g_pCompositor->getWindowsOnWorkspace(w->m_iID),
|
|
||||||
((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"),
|
|
||||||
PLASTW,
|
|
||||||
PLASTW ? escapeJSONStrings(PLASTW->m_szTitle).c_str() : ""
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -202,8 +197,9 @@ R"#({
|
|||||||
} else {
|
} else {
|
||||||
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
const auto PLASTW = w->getLastFocusedWindow();
|
const auto PLASTW = w->getLastFocusedWindow();
|
||||||
result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\tlastwindow: 0x%x\n\tlastwindowtitle: %s\n\n",
|
result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\tlastwindow: 0x%x\n\tlastwindowtitle: %s\n\n", w->m_iID,
|
||||||
w->m_iID, w->m_szName.c_str(), g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow, PLASTW, PLASTW ? PLASTW->m_szTitle.c_str() : "");
|
w->m_szName.c_str(), g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID),
|
||||||
|
(int)w->m_bHasFullscreenWindow, PLASTW, PLASTW ? PLASTW->m_szTitle.c_str() : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -234,8 +230,7 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
|||||||
R"#("%s": {
|
R"#("%s": {
|
||||||
"levels": {
|
"levels": {
|
||||||
)#",
|
)#",
|
||||||
escapeJSONStrings(mon->szName).c_str()
|
escapeJSONStrings(mon->szName).c_str());
|
||||||
);
|
|
||||||
|
|
||||||
int layerLevel = 0;
|
int layerLevel = 0;
|
||||||
for (auto& level : mon->m_aLayerSurfaceLists) {
|
for (auto& level : mon->m_aLayerSurfaceLists) {
|
||||||
@ -243,8 +238,7 @@ R"#("%s": {
|
|||||||
R"#(
|
R"#(
|
||||||
"%i": [
|
"%i": [
|
||||||
)#",
|
)#",
|
||||||
layerLevel
|
layerLevel);
|
||||||
);
|
|
||||||
for (auto& layer : level) {
|
for (auto& layer : level) {
|
||||||
result += getFormat(
|
result += getFormat(
|
||||||
R"#( {
|
R"#( {
|
||||||
@ -255,13 +249,7 @@ R"#( {
|
|||||||
"h": %i,
|
"h": %i,
|
||||||
"namespace": "%s"
|
"namespace": "%s"
|
||||||
},)#",
|
},)#",
|
||||||
layer.get(),
|
layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, escapeJSONStrings(layer->szNamespace).c_str());
|
||||||
layer->geometry.x,
|
|
||||||
layer->geometry.y,
|
|
||||||
layer->geometry.width,
|
|
||||||
layer->geometry.height,
|
|
||||||
escapeJSONStrings(layer->szNamespace).c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -294,7 +282,8 @@ R"#( {
|
|||||||
result += getFormat("\tLayer level %i:\n", layerLevel);
|
result += getFormat("\tLayer level %i:\n", layerLevel);
|
||||||
|
|
||||||
for (auto& layer : level) {
|
for (auto& layer : level) {
|
||||||
result += getFormat("\t\tLayer %x: xywh: %i %i %i %i, namespace: %s\n", layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, layer->szNamespace.c_str());
|
result += getFormat("\t\tLayer %x: xywh: %i %i %i %i, namespace: %s\n", layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width,
|
||||||
|
layer->geometry.height, layer->szNamespace.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
layerLevel++;
|
layerLevel++;
|
||||||
@ -320,10 +309,8 @@ R"#( {
|
|||||||
"name": "%s",
|
"name": "%s",
|
||||||
"defaultSpeed": %f
|
"defaultSpeed": %f
|
||||||
},)#",
|
},)#",
|
||||||
&m,
|
&m, escapeJSONStrings(m.name).c_str(),
|
||||||
escapeJSONStrings(m.name).c_str(),
|
wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f);
|
||||||
wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -345,16 +332,9 @@ R"#( {
|
|||||||
"active_keymap": "%s",
|
"active_keymap": "%s",
|
||||||
"main": %s
|
"main": %s
|
||||||
},)#",
|
},)#",
|
||||||
&k,
|
&k, escapeJSONStrings(k.name).c_str(), escapeJSONStrings(k.currentRules.rules).c_str(), escapeJSONStrings(k.currentRules.model).c_str(),
|
||||||
escapeJSONStrings(k.name).c_str(),
|
escapeJSONStrings(k.currentRules.layout).c_str(), escapeJSONStrings(k.currentRules.variant).c_str(), escapeJSONStrings(k.currentRules.options).c_str(),
|
||||||
escapeJSONStrings(k.currentRules.rules).c_str(),
|
escapeJSONStrings(KM).c_str(), (k.active ? "true" : "false"));
|
||||||
escapeJSONStrings(k.currentRules.model).c_str(),
|
|
||||||
escapeJSONStrings(k.currentRules.layout).c_str(),
|
|
||||||
escapeJSONStrings(k.currentRules.variant).c_str(),
|
|
||||||
escapeJSONStrings(k.currentRules.options).c_str(),
|
|
||||||
escapeJSONStrings(KM).c_str(),
|
|
||||||
(k.active ? "true" : "false")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -373,10 +353,7 @@ R"#( {
|
|||||||
"name": "%s"
|
"name": "%s"
|
||||||
}
|
}
|
||||||
},)#",
|
},)#",
|
||||||
&d,
|
&d, d.pTabletParent, escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str());
|
||||||
d.pTabletParent,
|
|
||||||
escapeJSONStrings(d.pTabletParent ? d.pTabletParent->name : "").c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& d : g_pInputManager->m_lTablets) {
|
for (auto& d : g_pInputManager->m_lTablets) {
|
||||||
@ -385,9 +362,7 @@ R"#( {
|
|||||||
"address": "0x%x",
|
"address": "0x%x",
|
||||||
"name": "%s"
|
"name": "%s"
|
||||||
},)#",
|
},)#",
|
||||||
&d,
|
&d, escapeJSONStrings(d.name).c_str());
|
||||||
escapeJSONStrings(d.name).c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& d : g_pInputManager->m_lTabletTools) {
|
for (auto& d : g_pInputManager->m_lTabletTools) {
|
||||||
@ -397,9 +372,7 @@ R"#( {
|
|||||||
"type": "tabletTool",
|
"type": "tabletTool",
|
||||||
"belongsTo": "0x%x"
|
"belongsTo": "0x%x"
|
||||||
},)#",
|
},)#",
|
||||||
&d,
|
&d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
|
||||||
d.wlrTabletTool ? d.wlrTabletTool->data : 0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -414,9 +387,7 @@ R"#( {
|
|||||||
"address": "0x%x",
|
"address": "0x%x",
|
||||||
"name": "%s"
|
"name": "%s"
|
||||||
},)#",
|
},)#",
|
||||||
&d,
|
&d, d.name.c_str());
|
||||||
d.name.c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -432,9 +403,7 @@ R"#( {
|
|||||||
"address": "0x%x",
|
"address": "0x%x",
|
||||||
"name": "%s"
|
"name": "%s"
|
||||||
},)#",
|
},)#",
|
||||||
&d,
|
&d, d.pWlrDevice ? d.pWlrDevice->name : "");
|
||||||
d.pWlrDevice ? d.pWlrDevice->name : ""
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
@ -448,14 +417,18 @@ R"#( {
|
|||||||
result += "mice:\n";
|
result += "mice:\n";
|
||||||
|
|
||||||
for (auto& m : g_pInputManager->m_lMice) {
|
for (auto& m : g_pInputManager->m_lMice) {
|
||||||
result += getFormat("\tMouse at %x:\n\t\t%s\n\t\t\tdefault speed: %f\n", &m, m.name.c_str(), (wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f));
|
result += getFormat(
|
||||||
|
"\tMouse at %x:\n\t\t%s\n\t\t\tdefault speed: %f\n", &m, m.name.c_str(),
|
||||||
|
(wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
result += "\n\nKeyboards:\n";
|
result += "\n\nKeyboards:\n";
|
||||||
|
|
||||||
for (auto& k : g_pInputManager->m_lKeyboards) {
|
for (auto& k : g_pInputManager->m_lKeyboards) {
|
||||||
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
|
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
|
||||||
result += getFormat("\tKeyboard at %x:\n\t\t%s\n\t\t\trules: r \"%s\", m \"%s\", l \"%s\", v \"%s\", o \"%s\"\n\t\t\tactive keymap: %s\n\t\t\tmain: %s\n", &k, k.name.c_str(), k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(), k.currentRules.options.c_str(), KM.c_str(), (k.active ? "yes" : "no"));
|
result += getFormat("\tKeyboard at %x:\n\t\t%s\n\t\t\trules: r \"%s\", m \"%s\", l \"%s\", v \"%s\", o \"%s\"\n\t\t\tactive keymap: %s\n\t\t\tmain: %s\n", &k,
|
||||||
|
k.name.c_str(), k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(),
|
||||||
|
k.currentRules.options.c_str(), KM.c_str(), (k.active ? "yes" : "no"));
|
||||||
}
|
}
|
||||||
|
|
||||||
result += "\n\nTablets:\n";
|
result += "\n\nTablets:\n";
|
||||||
@ -491,7 +464,8 @@ R"#( {
|
|||||||
std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
||||||
|
|
||||||
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" + removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nflags: (if any)\n";
|
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" +
|
||||||
|
removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nflags: (if any)\n";
|
||||||
|
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "legacyrenderer\n";
|
result += "legacyrenderer\n";
|
||||||
@ -514,7 +488,8 @@ R"#({
|
|||||||
"commit": "%s",
|
"commit": "%s",
|
||||||
"dirty": %s,
|
"dirty": %s,
|
||||||
"commit_message": "%s",
|
"commit_message": "%s",
|
||||||
"flags": [)#", GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str());
|
"flags": [)#",
|
||||||
|
GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str());
|
||||||
|
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "\"legacyrenderer\",";
|
result += "\"legacyrenderer\",";
|
||||||
@ -592,7 +567,7 @@ std::string dispatchKeyword(std::string in) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string reloadRequest(std::string request) {
|
std::string reloadRequest(const std::string& request) {
|
||||||
|
|
||||||
const auto REQMODE = request.substr(request.find_last_of(' ') + 1);
|
const auto REQMODE = request.substr(request.find_last_of(' ') + 1);
|
||||||
|
|
||||||
@ -628,7 +603,8 @@ std::string cursorPosRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
|||||||
"x": %i,
|
"x": %i,
|
||||||
"y": %i
|
"y": %i
|
||||||
}
|
}
|
||||||
)#", (int)CURSORPOS.x, (int)CURSORPOS.y);
|
)#",
|
||||||
|
(int)CURSORPOS.x, (int)CURSORPOS.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "error";
|
return "error";
|
||||||
@ -718,14 +694,15 @@ std::string dispatchSetCursor(std::string request) {
|
|||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string switchXKBLayoutRequest(std::string request) {
|
std::string switchXKBLayoutRequest(const std::string& request) {
|
||||||
CVarList vars(request, 0, ' ');
|
CVarList vars(request, 0, ' ');
|
||||||
|
|
||||||
const auto KB = vars[1];
|
const auto KB = vars[1];
|
||||||
const auto CMD = vars[2];
|
const auto CMD = vars[2];
|
||||||
|
|
||||||
// get kb
|
// get kb
|
||||||
const auto PKEYBOARD = std::find_if(g_pInputManager->m_lKeyboards.begin(), g_pInputManager->m_lKeyboards.end(), [&] (const SKeyboard& other) { return other.name == g_pInputManager->deviceNameToInternalString(KB); });
|
const auto PKEYBOARD = std::find_if(g_pInputManager->m_lKeyboards.begin(), g_pInputManager->m_lKeyboards.end(),
|
||||||
|
[&](const SKeyboard& other) { return other.name == g_pInputManager->deviceNameToInternalString(KB); });
|
||||||
|
|
||||||
if (PKEYBOARD == g_pInputManager->m_lKeyboards.end())
|
if (PKEYBOARD == g_pInputManager->m_lKeyboards.end())
|
||||||
return "device not found";
|
return "device not found";
|
||||||
@ -741,17 +718,17 @@ std::string switchXKBLayoutRequest(std::string request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CMD == "next") {
|
if (CMD == "next") {
|
||||||
wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked, activeLayout > LAYOUTS ? 0 : activeLayout + 1);
|
wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked,
|
||||||
|
activeLayout > LAYOUTS ? 0 : activeLayout + 1);
|
||||||
} else if (CMD == "prev") {
|
} else if (CMD == "prev") {
|
||||||
wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked, activeLayout == 0 ? LAYOUTS - 1 : activeLayout - 1);
|
wlr_keyboard_notify_modifiers(PWLRKEYBOARD, PWLRKEYBOARD->modifiers.depressed, PWLRKEYBOARD->modifiers.latched, PWLRKEYBOARD->modifiers.locked,
|
||||||
|
activeLayout == 0 ? LAYOUTS - 1 : activeLayout - 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int requestedLayout = 0;
|
int requestedLayout = 0;
|
||||||
try {
|
try {
|
||||||
requestedLayout = std::stoi(CMD);
|
requestedLayout = std::stoi(CMD);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) { return "invalid arg 2"; }
|
||||||
return "invalid arg 2";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (requestedLayout < 0 || (uint64_t)requestedLayout > LAYOUTS - 1) {
|
if (requestedLayout < 0 || (uint64_t)requestedLayout > LAYOUTS - 1) {
|
||||||
return "layout idx out of range of " + std::to_string(LAYOUTS);
|
return "layout idx out of range of " + std::to_string(LAYOUTS);
|
||||||
@ -789,7 +766,8 @@ std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat
|
|||||||
return "no such option";
|
return "no such option";
|
||||||
|
|
||||||
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL)
|
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL)
|
||||||
return getFormat("option %s\n\tint: %lld\n\tfloat: %f\n\tstr: \"%s\"\n\tdata: %x", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(), PCFGOPT->data.get());
|
return getFormat("option %s\n\tint: %lld\n\tfloat: %f\n\tstr: \"%s\"\n\tdata: %x", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(),
|
||||||
|
PCFGOPT->data.get());
|
||||||
else {
|
else {
|
||||||
return getFormat(
|
return getFormat(
|
||||||
R"#(
|
R"#(
|
||||||
@ -800,8 +778,8 @@ R"#(
|
|||||||
"str": "%s",
|
"str": "%s",
|
||||||
"data": "0x%x"
|
"data": "0x%x"
|
||||||
}
|
}
|
||||||
)#", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(), PCFGOPT->data.get()
|
)#",
|
||||||
);
|
curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str(), PCFGOPT->data.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,7 +975,10 @@ void HyprCtl::startHyprCtlSocket() {
|
|||||||
|
|
||||||
strcpy(SERVERADDRESS.sun_path, socketPath.c_str());
|
strcpy(SERVERADDRESS.sun_path, socketPath.c_str());
|
||||||
|
|
||||||
bind(iSocketFD, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
|
if (bind(iSocketFD, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
|
||||||
|
Debug::log(ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 10 max queued.
|
// 10 max queued.
|
||||||
listen(iSocketFD, 10);
|
listen(iSocketFD, 10);
|
||||||
|
@ -18,7 +18,8 @@ namespace HyprCtl {
|
|||||||
|
|
||||||
inline int iSocketFD = -1;
|
inline int iSocketFD = -1;
|
||||||
|
|
||||||
enum eHyprCtlOutputFormat {
|
enum eHyprCtlOutputFormat
|
||||||
|
{
|
||||||
FORMAT_NORMAL = 0,
|
FORMAT_NORMAL = 0,
|
||||||
FORMAT_JSON
|
FORMAT_JSON
|
||||||
};
|
};
|
||||||
|
@ -75,7 +75,8 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
|||||||
text = m_pMonitor->szName;
|
text = m_pMonitor->szName;
|
||||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||||
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
|
if (cairoExtents.width > maxX)
|
||||||
|
maxX = cairoExtents.width;
|
||||||
|
|
||||||
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 16);
|
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 16);
|
||||||
|
|
||||||
@ -91,7 +92,8 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
|||||||
text = std::string(std::to_string((int)FPS) + " FPS");
|
text = std::string(std::to_string((int)FPS) + " FPS");
|
||||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||||
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
|
if (cairoExtents.width > maxX)
|
||||||
|
maxX = cairoExtents.width;
|
||||||
|
|
||||||
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 10);
|
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 10);
|
||||||
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
|
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
|
||||||
@ -101,26 +103,30 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
|||||||
text = std::string("Avg Frametime: " + std::to_string((int)avgFrametime) + "." + std::to_string((int)(avgFrametime * 10.f) % 10) + "ms");
|
text = std::string("Avg Frametime: " + std::to_string((int)avgFrametime) + "." + std::to_string((int)(avgFrametime * 10.f) % 10) + "ms");
|
||||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||||
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
|
if (cairoExtents.width > maxX)
|
||||||
|
maxX = cairoExtents.width;
|
||||||
|
|
||||||
yOffset += 11;
|
yOffset += 11;
|
||||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||||
text = std::string("Avg Rendertime: " + std::to_string((int)avgRenderTime) + "." + std::to_string((int)(avgRenderTime * 10.f) % 10) + "ms");
|
text = std::string("Avg Rendertime: " + std::to_string((int)avgRenderTime) + "." + std::to_string((int)(avgRenderTime * 10.f) % 10) + "ms");
|
||||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||||
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
|
if (cairoExtents.width > maxX)
|
||||||
|
maxX = cairoExtents.width;
|
||||||
|
|
||||||
yOffset += 11;
|
yOffset += 11;
|
||||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||||
text = std::string("Avg Rendertime (no overlay): " + std::to_string((int)avgRenderTimeNoOverlay) + "." + std::to_string((int)(avgRenderTimeNoOverlay * 10.f) % 10) + "ms");
|
text = std::string("Avg Rendertime (no overlay): " + std::to_string((int)avgRenderTimeNoOverlay) + "." + std::to_string((int)(avgRenderTimeNoOverlay * 10.f) % 10) + "ms");
|
||||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||||
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
|
if (cairoExtents.width > maxX)
|
||||||
|
maxX = cairoExtents.width;
|
||||||
|
|
||||||
yOffset += 11;
|
yOffset += 11;
|
||||||
|
|
||||||
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
|
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
|
||||||
m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset - 1, (int)maxX + 2, yOffset - offset + 2};
|
m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset - 1, (int)maxX + 2,
|
||||||
|
yOffset - offset + 2};
|
||||||
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
|
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
|
||||||
|
|
||||||
return yOffset - offset;
|
return yOffset - offset;
|
||||||
|
@ -26,14 +26,12 @@ private:
|
|||||||
|
|
||||||
class CHyprDebugOverlay {
|
class CHyprDebugOverlay {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
void renderData(CMonitor*, float µs);
|
void renderData(CMonitor*, float µs);
|
||||||
void renderDataNoOverlay(CMonitor*, float µs);
|
void renderDataNoOverlay(CMonitor*, float µs);
|
||||||
void frameData(CMonitor*);
|
void frameData(CMonitor*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
|
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
|
||||||
|
|
||||||
cairo_surface_t* m_pCairoSurface = nullptr;
|
cairo_surface_t* m_pCairoSurface = nullptr;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void Debug::init(std::string IS) {
|
void Debug::init(const std::string& IS) {
|
||||||
logFile = "/tmp/hypr/" + IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
|
logFile = "/tmp/hypr/" + IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,23 +35,12 @@ void Debug::log(LogLevel level, const char* fmt, ...) {
|
|||||||
ofs.open(logFile, std::ios::out | std::ios::app);
|
ofs.open(logFile, std::ios::out | std::ios::app);
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LOG:
|
case LOG: ofs << "[LOG] "; break;
|
||||||
ofs << "[LOG] ";
|
case WARN: ofs << "[WARN] "; break;
|
||||||
break;
|
case ERR: ofs << "[ERR] "; break;
|
||||||
case WARN:
|
case CRIT: ofs << "[CRITICAL] "; break;
|
||||||
ofs << "[WARN] ";
|
case INFO: ofs << "[INFO] "; break;
|
||||||
break;
|
default: break;
|
||||||
case ERR:
|
|
||||||
ofs << "[ERR] ";
|
|
||||||
break;
|
|
||||||
case CRIT:
|
|
||||||
ofs << "[CRITICAL] ";
|
|
||||||
break;
|
|
||||||
case INFO:
|
|
||||||
ofs << "[INFO] ";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// print date and time to the ofs
|
// print date and time to the ofs
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
#define LOGMESSAGESIZE 1024
|
#define LOGMESSAGESIZE 1024
|
||||||
|
|
||||||
enum LogLevel {
|
enum LogLevel
|
||||||
|
{
|
||||||
NONE = -1,
|
NONE = -1,
|
||||||
LOG = 0,
|
LOG = 0,
|
||||||
WARN,
|
WARN,
|
||||||
@ -14,7 +15,7 @@ enum LogLevel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace Debug {
|
namespace Debug {
|
||||||
void init(std::string IS);
|
void init(const std::string& IS);
|
||||||
void log(LogLevel level, const char* fmt, ...);
|
void log(LogLevel level, const char* fmt, ...);
|
||||||
void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
|
void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
|
||||||
|
|
||||||
|
@ -18,22 +18,24 @@
|
|||||||
#define ISDEBUG false
|
#define ISDEBUG false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LISTENER(name) void listener_##name(wl_listener*, void*); inline wl_listener listen_##name = { .notify = listener_##name }
|
#define LISTENER(name) \
|
||||||
|
void listener_##name(wl_listener*, void*); \
|
||||||
|
inline wl_listener listen_##name = {.notify = listener_##name}
|
||||||
#define DYNLISTENFUNC(name) void listener_##name(void*, void*)
|
#define DYNLISTENFUNC(name) void listener_##name(void*, void*)
|
||||||
#define DYNLISTENER(name) CHyprWLListener hyprListener_##name
|
#define DYNLISTENER(name) CHyprWLListener hyprListener_##name
|
||||||
#define DYNMULTILISTENER(name) wl_listener listen_##name
|
#define DYNMULTILISTENER(name) wl_listener listen_##name
|
||||||
|
|
||||||
#define VECINRECT(vec, x1, y1, x2, y2) (vec.x >= (x1) && vec.x <= (x2) && vec.y >= (y1) && vec.y <= (y2))
|
#define VECINRECT(vec, x1, y1, x2, y2) ((vec).x >= (x1) && (vec).x <= (x2) && (vec).y >= (y1) && (vec).y <= (y2))
|
||||||
|
|
||||||
#define DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < delta)
|
#define DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < (delta))
|
||||||
|
|
||||||
#define PIXMAN_DAMAGE_FOREACH(region) int rectsNum = 0; \
|
#define PIXMAN_DAMAGE_FOREACH(region) \
|
||||||
|
int rectsNum = 0; \
|
||||||
const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \
|
const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \
|
||||||
for (int i = 0; i < rectsNum; ++i)
|
for (int i = 0; i < rectsNum; ++i)
|
||||||
|
|
||||||
#define PIXMAN_REGION_FOREACH(region) PIXMAN_DAMAGE_FOREACH(region)
|
#define PIXMAN_REGION_FOREACH(region) PIXMAN_DAMAGE_FOREACH(region)
|
||||||
|
|
||||||
|
|
||||||
#define interface class
|
#define interface class
|
||||||
|
|
||||||
#define STICKS(a, b) abs((a) - (b)) < 2
|
#define STICKS(a, b) abs((a) - (b)) < 2
|
||||||
@ -43,12 +45,15 @@
|
|||||||
#define GREEN(c) ((double)(((c) >> 8) & 0xff) / 255.0)
|
#define GREEN(c) ((double)(((c) >> 8) & 0xff) / 255.0)
|
||||||
#define BLUE(c) ((double)(((c)) & 0xff) / 255.0)
|
#define BLUE(c) ((double)(((c)) & 0xff) / 255.0)
|
||||||
|
|
||||||
#define HYPRATOM(name) {name, 0}
|
#define HYPRATOM(name) \
|
||||||
|
{ name, 0 }
|
||||||
|
|
||||||
#ifndef __INTELLISENSE__
|
#ifndef __INTELLISENSE__
|
||||||
#define RASSERT(expr, reason, ...) \
|
#define RASSERT(expr, reason, ...) \
|
||||||
if (!(expr)) { \
|
if (!(expr)) { \
|
||||||
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \
|
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", \
|
||||||
|
getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, \
|
||||||
|
([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \
|
||||||
printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
|
printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
|
||||||
*((int*)nullptr) = 1; /* so that we crash and get a coredump */ \
|
*((int*)nullptr) = 1; /* so that we crash and get a coredump */ \
|
||||||
}
|
}
|
||||||
@ -59,7 +64,11 @@
|
|||||||
#define ASSERT(expr) RASSERT(expr, "?")
|
#define ASSERT(expr) RASSERT(expr, "?")
|
||||||
|
|
||||||
#if ISDEBUG
|
#if ISDEBUG
|
||||||
#define UNREACHABLE() { Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); *((int*)nullptr) = 1; }
|
#define UNREACHABLE() \
|
||||||
|
{ \
|
||||||
|
Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); \
|
||||||
|
*((int*)nullptr) = 1; \
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#define UNREACHABLE() std::unreachable();
|
#define UNREACHABLE() std::unreachable();
|
||||||
#endif
|
#endif
|
||||||
@ -78,6 +87,6 @@
|
|||||||
#define GIT_DIRTY "?"
|
#define GIT_DIRTY "?"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SPECIAL_WORKSPACE_START -99
|
#define SPECIAL_WORKSPACE_START (-99)
|
||||||
|
|
||||||
#define PI 3.14159265358979
|
#define PI 3.14159265358979
|
||||||
|
@ -86,9 +86,7 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
|
|||||||
Debug::log(LOG, "Attached a switch device with name %s", DEVICE->name);
|
Debug::log(LOG, "Attached a switch device with name %s", DEVICE->name);
|
||||||
g_pInputManager->newSwitch(DEVICE);
|
g_pInputManager->newSwitch(DEVICE);
|
||||||
break;
|
break;
|
||||||
default:
|
default: Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name); break;
|
||||||
Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pInputManager->updateCapabilities();
|
g_pInputManager->updateCapabilities();
|
||||||
@ -128,13 +126,13 @@ void Events::listener_destroyConstraint(void* owner, void* data) {
|
|||||||
|
|
||||||
if (PWINDOW) {
|
if (PWINDOW) {
|
||||||
if (PWINDOW->m_bIsX11) {
|
if (PWINDOW->m_bIsX11) {
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, PCONSTRAINT->positionHint.x + PWINDOW->m_uSurface.xwayland->x,
|
||||||
PCONSTRAINT->positionHint.x + PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y + PCONSTRAINT->positionHint.y);
|
PWINDOW->m_uSurface.xwayland->y + PCONSTRAINT->positionHint.y);
|
||||||
|
|
||||||
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->positionHint.x, PCONSTRAINT->positionHint.y);
|
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->positionHint.x, PCONSTRAINT->positionHint.y);
|
||||||
} else {
|
} else {
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, PCONSTRAINT->positionHint.x + PWINDOW->m_vRealPosition.vec().x,
|
||||||
PCONSTRAINT->positionHint.x + PWINDOW->m_vRealPosition.vec().x, PCONSTRAINT->positionHint.y + PWINDOW->m_vRealPosition.vec().y);
|
PCONSTRAINT->positionHint.y + PWINDOW->m_vRealPosition.vec().y);
|
||||||
|
|
||||||
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->positionHint.x, PCONSTRAINT->positionHint.y);
|
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->positionHint.x, PCONSTRAINT->positionHint.y);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
|||||||
|
|
||||||
layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace);
|
layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace);
|
||||||
|
|
||||||
Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer, PMONITOR->szName.c_str());
|
Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer,
|
||||||
|
PMONITOR->szName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_destroyLayerSurface(void* owner, void* data) {
|
void Events::listener_destroyLayerSurface(void* owner, void* data) {
|
||||||
@ -94,7 +95,8 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
|
|||||||
PMONITOR->scheduledRecalc = true;
|
PMONITOR->scheduledRecalc = true;
|
||||||
|
|
||||||
// and damage
|
// and damage
|
||||||
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
|
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
|
||||||
|
layersurface->geometry.height};
|
||||||
g_pHyprRenderer->damageBox(&geomFixed);
|
g_pHyprRenderer->damageBox(&geomFixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,17 +139,20 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
|
|||||||
|
|
||||||
wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output);
|
wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output);
|
||||||
|
|
||||||
if (layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint)) { // don't focus if constrained
|
if (layersurface->layerSurface->current.keyboard_interactive &&
|
||||||
|
(!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint)) { // don't focus if constrained
|
||||||
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
|
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
|
||||||
|
|
||||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y);
|
const auto LOCAL =
|
||||||
|
g_pInputManager->getMouseCoordsInternal() - Vector2D(layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y);
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y);
|
||||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
|
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
|
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
|
||||||
|
|
||||||
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
|
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
|
||||||
|
layersurface->geometry.height};
|
||||||
g_pHyprRenderer->damageBox(&geomFixed);
|
g_pHyprRenderer->damageBox(&geomFixed);
|
||||||
|
|
||||||
layersurface->alpha.setValue(0);
|
layersurface->alpha.setValue(0);
|
||||||
@ -209,11 +214,12 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||||||
g_pCompositor->m_pLastFocus = nullptr;
|
g_pCompositor->m_pLastFocus = nullptr;
|
||||||
|
|
||||||
// find LS-es to focus
|
// find LS-es to focus
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
|
||||||
|
&surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
if (!foundSurface)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
|
||||||
|
&surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
if (!foundSurface) {
|
if (!foundSurface) {
|
||||||
// if there isn't any, focus the last window
|
// if there isn't any, focus the last window
|
||||||
@ -226,13 +232,16 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
|
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
|
||||||
|
layersurface->geometry.height};
|
||||||
g_pHyprRenderer->damageBox(&geomFixed);
|
g_pHyprRenderer->damageBox(&geomFixed);
|
||||||
|
|
||||||
geomFixed = {layersurface->geometry.x + (int)PMONITOR->vecPosition.x, layersurface->geometry.y + (int)PMONITOR->vecPosition.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
|
geomFixed = {layersurface->geometry.x + (int)PMONITOR->vecPosition.x, layersurface->geometry.y + (int)PMONITOR->vecPosition.y,
|
||||||
|
(int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
|
||||||
g_pHyprRenderer->damageBox(&geomFixed);
|
g_pHyprRenderer->damageBox(&geomFixed);
|
||||||
|
|
||||||
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
|
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width,
|
||||||
|
(int)layersurface->layerSurface->surface->current.height};
|
||||||
layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
|
layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +304,8 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
|
|||||||
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
|
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
|
||||||
|
|
||||||
// update geom if it changed
|
// update geom if it changed
|
||||||
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, layersurface->layerSurface->surface->current.width, layersurface->layerSurface->surface->current.height};
|
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, layersurface->layerSurface->surface->current.width,
|
||||||
|
layersurface->layerSurface->surface->current.height};
|
||||||
|
|
||||||
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
|
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,8 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
|
|||||||
|
|
||||||
const auto XCURSOR = wlr_xcursor_manager_get_xcursor(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", 1);
|
const auto XCURSOR = wlr_xcursor_manager_get_xcursor(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", 1);
|
||||||
if (XCURSOR) {
|
if (XCURSOR) {
|
||||||
wlr_xwayland_set_cursor(g_pXWaylandManager->m_sWLRXWayland, XCURSOR->images[0]->buffer, XCURSOR->images[0]->width * 4, XCURSOR->images[0]->width, XCURSOR->images[0]->height, XCURSOR->images[0]->hotspot_x, XCURSOR->images[0]->hotspot_y);
|
wlr_xwayland_set_cursor(g_pXWaylandManager->m_sWLRXWayland, XCURSOR->images[0]->buffer, XCURSOR->images[0]->width * 4, XCURSOR->images[0]->width,
|
||||||
|
XCURSOR->images[0]->height, XCURSOR->images[0]->hotspot_x, XCURSOR->images[0]->hotspot_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_disconnect(XCBCONNECTION);
|
xcb_disconnect(XCBCONNECTION);
|
||||||
@ -112,7 +113,8 @@ void Events::listener_startDrag(wl_listener* listener, void* data) {
|
|||||||
g_pInputManager->m_sDrag.hyprListener_mapIcon.initCallback(&wlrDrag->icon->events.map, &Events::listener_mapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
g_pInputManager->m_sDrag.hyprListener_mapIcon.initCallback(&wlrDrag->icon->events.map, &Events::listener_mapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
||||||
g_pInputManager->m_sDrag.hyprListener_unmapIcon.initCallback(&wlrDrag->icon->events.unmap, &Events::listener_unmapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
g_pInputManager->m_sDrag.hyprListener_unmapIcon.initCallback(&wlrDrag->icon->events.unmap, &Events::listener_unmapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
||||||
g_pInputManager->m_sDrag.hyprListener_destroyIcon.initCallback(&wlrDrag->icon->events.destroy, &Events::listener_destroyDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
g_pInputManager->m_sDrag.hyprListener_destroyIcon.initCallback(&wlrDrag->icon->events.destroy, &Events::listener_destroyDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
||||||
g_pInputManager->m_sDrag.hyprListener_commitIcon.initCallback(&wlrDrag->icon->surface->events.commit, &Events::listener_commitDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
g_pInputManager->m_sDrag.hyprListener_commitIcon.initCallback(&wlrDrag->icon->surface->events.commit, &Events::listener_commitDragIcon, &g_pInputManager->m_sDrag,
|
||||||
|
"DragIcon");
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto* const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue;
|
static auto* const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue;
|
||||||
@ -129,7 +131,8 @@ void Events::listener_destroyDrag(void* owner, void* data) {
|
|||||||
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
|
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
|
||||||
|
|
||||||
if (g_pInputManager->m_sDrag.drag && g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.dragIcon->surface)
|
if (g_pInputManager->m_sDrag.drag && g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.dragIcon->surface)
|
||||||
g_pHyprRenderer->damageBox(g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4, g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4);
|
g_pHyprRenderer->damageBox(g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4,
|
||||||
|
g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4);
|
||||||
|
|
||||||
g_pInputManager->m_sDrag.drag = nullptr;
|
g_pInputManager->m_sDrag.drag = nullptr;
|
||||||
g_pInputManager->m_sDrag.dragIcon = nullptr;
|
g_pInputManager->m_sDrag.dragIcon = nullptr;
|
||||||
|
@ -140,7 +140,8 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checks //
|
// checks //
|
||||||
if (PMONITOR->ID == pMostHzMonitor->ID || !*PNOVFR) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
|
if (PMONITOR->ID == pMostHzMonitor->ID ||
|
||||||
|
!*PNOVFR) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
|
||||||
g_pCompositor->sanityCheckWorkspaces();
|
g_pCompositor->sanityCheckWorkspaces();
|
||||||
g_pAnimationManager->tick();
|
g_pAnimationManager->tick();
|
||||||
|
|
||||||
@ -202,7 +203,8 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we have no tracking or full tracking, invalidate the entire monitor
|
// if we have no tracking or full tracking, invalidate the entire monitor
|
||||||
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || PMONITOR->forceFullFrames > 0 || damageBlinkCleanup > 0 || PMONITOR->isMirror() /* why??? */) {
|
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || PMONITOR->forceFullFrames > 0 || damageBlinkCleanup > 0 ||
|
||||||
|
PMONITOR->isMirror() /* why??? */) {
|
||||||
pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecTransformedSize.x * 10, (int)PMONITOR->vecTransformedSize.y * 10); // wot?
|
pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecTransformedSize.x * 10, (int)PMONITOR->vecTransformedSize.y * 10); // wot?
|
||||||
|
|
||||||
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
|
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
|
||||||
@ -231,7 +233,6 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||||||
PMONITOR->forceFullFrames = 0;
|
PMONITOR->forceFullFrames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: this is getting called with extents being 0,0,0,0 should it be?
|
// TODO: this is getting called with extents being 0,0,0,0 should it be?
|
||||||
// potentially can save on resources.
|
// potentially can save on resources.
|
||||||
|
|
||||||
@ -338,7 +339,7 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
|||||||
if (!g_pCompositor->m_bUnsafeState) {
|
if (!g_pCompositor->m_bUnsafeState) {
|
||||||
Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->output->name);
|
Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->output->name);
|
||||||
|
|
||||||
g_pCompositor->m_vRealMonitors.erase(std::remove_if(g_pCompositor->m_vRealMonitors.begin(), g_pCompositor->m_vRealMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; }));
|
std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; });
|
||||||
|
|
||||||
if (pMostHzMonitor == pMonitor) {
|
if (pMostHzMonitor == pMonitor) {
|
||||||
int mostHz = 0;
|
int mostHz = 0;
|
||||||
|
@ -69,7 +69,8 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
|
|||||||
|
|
||||||
pHyprPopup->monitor = PMONITOR;
|
pHyprPopup->monitor = PMONITOR;
|
||||||
|
|
||||||
Debug::log(LOG, "Popup: Unconstrained from lx ly: %f %f, pHyprPopup lx ly: %f %f", (float)PMONITOR->vecPosition.x, (float)PMONITOR->vecPosition.y, (float)pHyprPopup->lx, (float)pHyprPopup->ly);
|
Debug::log(LOG, "Popup: Unconstrained from lx ly: %f %f, pHyprPopup lx ly: %f %f", (float)PMONITOR->vecPosition.x, (float)PMONITOR->vecPosition.y, (float)pHyprPopup->lx,
|
||||||
|
(float)pHyprPopup->ly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_newPopup(void* owner, void* data) {
|
void Events::listener_newPopup(void* owner, void* data) {
|
||||||
@ -200,5 +201,5 @@ void Events::listener_destroyPopupXDG(void* owner, void* data) {
|
|||||||
PPOPUP->pSurfaceTree = nullptr;
|
PPOPUP->pSurfaceTree = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pCompositor->m_vXDGPopups.erase(std::remove_if(g_pCompositor->m_vXDGPopups.begin(), g_pCompositor->m_vXDGPopups.end(), [&](std::unique_ptr<SXDGPopup>& el) { return el.get() == PPOPUP; }));
|
std::erase_if(g_pCompositor->m_vXDGPopups, [&](std::unique_ptr<SXDGPopup>& el) { return el.get() == PPOPUP; });
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
static auto* const PSWALLOWREGEX = &g_pConfigManager->getConfigValuePtr("misc:swallow_regex")->strValue;
|
static auto* const PSWALLOWREGEX = &g_pConfigManager->getConfigValuePtr("misc:swallow_regex")->strValue;
|
||||||
|
|
||||||
auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||||
const auto PWORKSPACE = PMONITOR->specialWorkspaceID ? g_pCompositor->getWorkspaceByID(PMONITOR->specialWorkspaceID) : g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
const auto PWORKSPACE =
|
||||||
|
PMONITOR->specialWorkspaceID ? g_pCompositor->getWorkspaceByID(PMONITOR->specialWorkspaceID) : g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
||||||
PWINDOW->m_iMonitorID = PMONITOR->ID;
|
PWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||||
PWINDOW->m_bMappedX11 = true;
|
PWINDOW->m_bMappedX11 = true;
|
||||||
PWINDOW->m_iWorkspaceID = PMONITOR->specialWorkspaceID ? PMONITOR->specialWorkspaceID : PMONITOR->activeWorkspace;
|
PWINDOW->m_iWorkspaceID = PMONITOR->specialWorkspaceID ? PMONITOR->specialWorkspaceID : PMONITOR->activeWorkspace;
|
||||||
@ -107,14 +108,16 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(PWINDOW);
|
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(PWINDOW);
|
||||||
std::string requestedWorkspace = "";
|
std::string requestedWorkspace = "";
|
||||||
bool workspaceSilent = false;
|
bool workspaceSilent = false;
|
||||||
bool requestsFullscreen = PWINDOW->m_bWantsInitialFullscreen || (!PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xdg->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL && PWINDOW->m_uSurface.xdg->toplevel->requested.fullscreen) || (PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xwayland->fullscreen);
|
bool requestsFullscreen = PWINDOW->m_bWantsInitialFullscreen ||
|
||||||
|
(!PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xdg->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL && PWINDOW->m_uSurface.xdg->toplevel->requested.fullscreen) ||
|
||||||
|
(PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xwayland->fullscreen);
|
||||||
bool shouldFocus = true;
|
bool shouldFocus = true;
|
||||||
bool workspaceSpecial = false;
|
bool workspaceSpecial = false;
|
||||||
|
|
||||||
for (auto& r : WINDOWRULES) {
|
for (auto& r : WINDOWRULES) {
|
||||||
if (r.szRule.find("monitor") == 0) {
|
if (r.szRule.find("monitor") == 0) {
|
||||||
try {
|
try {
|
||||||
const auto MONITORSTR = r.szRule.substr(r.szRule.find(" "));
|
const auto MONITORSTR = r.szRule.substr(r.szRule.find(' '));
|
||||||
|
|
||||||
if (MONITORSTR == "unset") {
|
if (MONITORSTR == "unset") {
|
||||||
PWINDOW->m_iMonitorID = PMONITOR->ID;
|
PWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||||
@ -133,9 +136,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(ERR, "Rule monitor, applying to window %x -> mon: %i, workspace: %i", PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
|
Debug::log(ERR, "Rule monitor, applying to window %x -> mon: %i, workspace: %i", PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) { Debug::log(ERR, "Rule monitor failed, rule: %s -> %s | err: %s", r.szRule.c_str(), r.szValue.c_str(), e.what()); }
|
||||||
Debug::log(ERR, "Rule monitor failed, rule: %s -> %s | err: %s", r.szRule.c_str(), r.szValue.c_str(), e.what());
|
|
||||||
}
|
|
||||||
} else if (r.szRule.find("workspace") == 0) {
|
} else if (r.szRule.find("workspace") == 0) {
|
||||||
// check if it isnt unset
|
// check if it isnt unset
|
||||||
const auto WORKSPACERQ = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
|
const auto WORKSPACERQ = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
|
||||||
@ -270,14 +271,18 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
for (auto& r : WINDOWRULES) {
|
for (auto& r : WINDOWRULES) {
|
||||||
if (r.szRule.find("size") == 0) {
|
if (r.szRule.find("size") == 0) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(" "));
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||||
const auto SIZEYSTR = VALUE.substr(VALUE.find(" ") + 1);
|
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
|
||||||
|
|
||||||
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW);
|
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW);
|
||||||
|
|
||||||
const auto SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, 20.0, PMONITOR->vecSize.x) : (!SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stoi(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
const auto SIZEX = SIZEXSTR == "max" ?
|
||||||
const auto SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, 20.0, PMONITOR->vecSize.y) : (!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stoi(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
std::clamp(MAXSIZE.x, 20.0, PMONITOR->vecSize.x) :
|
||||||
|
(!SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stoi(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
||||||
|
const auto SIZEY = SIZEYSTR == "max" ?
|
||||||
|
std::clamp(MAXSIZE.y, 20.0, PMONITOR->vecSize.y) :
|
||||||
|
(!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stoi(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
||||||
|
|
||||||
Debug::log(LOG, "Rule size, applying to window %x", PWINDOW);
|
Debug::log(LOG, "Rule size, applying to window %x", PWINDOW);
|
||||||
|
|
||||||
@ -285,50 +290,46 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) {
|
} catch (...) { Debug::log(LOG, "Rule size failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
|
||||||
Debug::log(LOG, "Rule size failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
|
|
||||||
}
|
|
||||||
} else if (r.szRule.find("minsize") == 0) {
|
} else if (r.szRule.find("minsize") == 0) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(" "));
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||||
const auto SIZEYSTR = VALUE.substr(VALUE.find(" ") + 1);
|
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
|
||||||
|
|
||||||
const auto SIZE = Vector2D(std::max((double)std::stoll(SIZEXSTR), PWINDOW->m_vRealSize.goalv().x), std::max((double)std::stoll(SIZEYSTR), PWINDOW->m_vRealSize.goalv().y));
|
const auto SIZE =
|
||||||
|
Vector2D(std::max((double)std::stoll(SIZEXSTR), PWINDOW->m_vRealSize.goalv().x), std::max((double)std::stoll(SIZEYSTR), PWINDOW->m_vRealSize.goalv().y));
|
||||||
|
|
||||||
PWINDOW->m_vRealSize = SIZE;
|
PWINDOW->m_vRealSize = SIZE;
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) {
|
} catch (...) { Debug::log(LOG, "Rule minsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
|
||||||
Debug::log(LOG, "Rule minsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
|
|
||||||
}
|
|
||||||
} else if (r.szRule.find("maxsize") == 0) {
|
} else if (r.szRule.find("maxsize") == 0) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(" "));
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||||
const auto SIZEYSTR = VALUE.substr(VALUE.find(" ") + 1);
|
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
|
||||||
|
|
||||||
const auto SIZE = Vector2D(std::min((double)std::stoll(SIZEXSTR), PWINDOW->m_vRealSize.goalv().x), std::min((double)std::stoll(SIZEYSTR), PWINDOW->m_vRealSize.goalv().y));
|
const auto SIZE =
|
||||||
|
Vector2D(std::min((double)std::stoll(SIZEXSTR), PWINDOW->m_vRealSize.goalv().x), std::min((double)std::stoll(SIZEYSTR), PWINDOW->m_vRealSize.goalv().y));
|
||||||
|
|
||||||
PWINDOW->m_vRealSize = SIZE;
|
PWINDOW->m_vRealSize = SIZE;
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) {
|
} catch (...) { Debug::log(LOG, "Rule maxsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
|
||||||
Debug::log(LOG, "Rule maxsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
|
|
||||||
}
|
|
||||||
} else if (r.szRule.find("move") == 0) {
|
} else if (r.szRule.find("move") == 0) {
|
||||||
try {
|
try {
|
||||||
auto value = r.szRule.substr(r.szRule.find(" ") + 1);
|
auto value = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
|
|
||||||
const bool CURSOR = value.find("cursor") == 0;
|
const bool CURSOR = value.find("cursor") == 0;
|
||||||
|
|
||||||
if (CURSOR)
|
if (CURSOR)
|
||||||
value = value.substr(value.find_first_of(' ') + 1);
|
value = value.substr(value.find_first_of(' ') + 1);
|
||||||
|
|
||||||
const auto POSXSTR = value.substr(0, value.find(" "));
|
const auto POSXSTR = value.substr(0, value.find(' '));
|
||||||
const auto POSYSTR = value.substr(value.find(" ") + 1);
|
const auto POSYSTR = value.substr(value.find(' ') + 1);
|
||||||
|
|
||||||
int posX = 0;
|
int posX = 0;
|
||||||
int posY = 0;
|
int posY = 0;
|
||||||
@ -336,7 +337,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
if (POSXSTR.find("100%-") == 0) {
|
if (POSXSTR.find("100%-") == 0) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||||
const auto POSXRAW = POSXSTR.substr(5);
|
const auto POSXRAW = POSXSTR.substr(5);
|
||||||
posX = PMONITOR->vecSize.x - (!POSXRAW.contains('%') ? std::stoi(POSXRAW) : std::stoi(POSXRAW.substr(0, POSXRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
posX =
|
||||||
|
PMONITOR->vecSize.x - (!POSXRAW.contains('%') ? std::stoi(POSXRAW) : std::stoi(POSXRAW.substr(0, POSXRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
||||||
|
|
||||||
if (CURSOR)
|
if (CURSOR)
|
||||||
Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!");
|
Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!");
|
||||||
@ -347,14 +349,16 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
if (POSXSTR == "cursor") {
|
if (POSXSTR == "cursor") {
|
||||||
posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x;
|
posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x;
|
||||||
} else {
|
} else {
|
||||||
posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x + (!POSXSTR.contains('%') ? std::stoi(POSXSTR) : std::stoi(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize.goalv().x);
|
posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x +
|
||||||
|
(!POSXSTR.contains('%') ? std::stoi(POSXSTR) : std::stoi(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize.goalv().x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (POSYSTR.find("100%-") == 0) {
|
if (POSYSTR.find("100%-") == 0) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||||
const auto POSYRAW = POSYSTR.substr(5);
|
const auto POSYRAW = POSYSTR.substr(5);
|
||||||
posY = PMONITOR->vecSize.y - (!POSYRAW.contains('%') ? std::stoi(POSYRAW) : std::stoi(POSYRAW.substr(0, POSYRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
posY =
|
||||||
|
PMONITOR->vecSize.y - (!POSYRAW.contains('%') ? std::stoi(POSYRAW) : std::stoi(POSYRAW.substr(0, POSYRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
||||||
|
|
||||||
if (CURSOR)
|
if (CURSOR)
|
||||||
Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!");
|
Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!");
|
||||||
@ -365,7 +369,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
if (POSYSTR == "cursor") {
|
if (POSYSTR == "cursor") {
|
||||||
posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y;
|
posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y;
|
||||||
} else {
|
} else {
|
||||||
posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y + (!POSYSTR.contains('%') ? std::stoi(POSYSTR) : std::stoi(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize.goalv().y);
|
posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y +
|
||||||
|
(!POSYSTR.contains('%') ? std::stoi(POSYSTR) : std::stoi(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize.goalv().y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,9 +379,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
PWINDOW->m_vRealPosition = Vector2D(posX, posY) + PMONITOR->vecPosition;
|
PWINDOW->m_vRealPosition = Vector2D(posX, posY) + PMONITOR->vecPosition;
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
} catch (...) {
|
} catch (...) { Debug::log(LOG, "Rule move failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); }
|
||||||
Debug::log(LOG, "Rule move failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
|
|
||||||
}
|
|
||||||
} else if (r.szRule == "center") {
|
} else if (r.szRule == "center") {
|
||||||
PWINDOW->m_vRealPosition = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f - PWINDOW->m_vRealSize.goalv() / 2.f;
|
PWINDOW->m_vRealPosition = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f - PWINDOW->m_vRealSize.goalv() / 2.f;
|
||||||
}
|
}
|
||||||
@ -422,21 +425,28 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late");
|
||||||
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XDG Window Late");
|
||||||
PWINDOW->hyprListener_newPopupXDG.initCallback(&PWINDOW->m_uSurface.xdg->events.new_popup, &Events::listener_newPopupXDG, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_newPopupXDG.initCallback(&PWINDOW->m_uSurface.xdg->events.new_popup, &Events::listener_newPopupXDG, PWINDOW, "XDG Window Late");
|
||||||
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW,
|
||||||
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW, "XDG Window Late");
|
"XDG Window Late");
|
||||||
|
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW,
|
||||||
|
"XDG Window Late");
|
||||||
PWINDOW->hyprListener_requestMove.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_move, &Events::listener_requestMove, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_requestMove.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_move, &Events::listener_requestMove, PWINDOW, "XDG Window Late");
|
||||||
PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW, "XDG Window Late");
|
||||||
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW,
|
||||||
|
"XDG Window Late");
|
||||||
} else {
|
} else {
|
||||||
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW,
|
||||||
|
"XWayland Window Late");
|
||||||
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
|
||||||
PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late");
|
||||||
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
|
||||||
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW, "Xwayland Window Late");
|
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW,
|
||||||
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_maximize, &Events::listener_requestMaximize, PWINDOW, "Xwayland Window Late");
|
"Xwayland Window Late");
|
||||||
|
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_maximize, &Events::listener_requestMaximize, PWINDOW,
|
||||||
|
"Xwayland Window Late");
|
||||||
|
|
||||||
if (PWINDOW->m_iX11Type == 2)
|
if (PWINDOW->m_iX11Type == 2)
|
||||||
PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW,
|
||||||
|
"XWayland Window Late");
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the animation thing
|
// do the animation thing
|
||||||
@ -539,10 +549,12 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
|
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y,
|
||||||
|
PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
|
||||||
|
|
||||||
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
|
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", getFormat("%x,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
|
g_pEventManager->postEvent(
|
||||||
|
SHyprIPCEvent{"openwindow", getFormat("%x,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
|
||||||
|
|
||||||
// recalc the values for this window
|
// recalc the values for this window
|
||||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
||||||
@ -862,8 +874,10 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(std::floor(POS.x) - PWINDOW->m_uSurface.xwayland->x) > 2 || abs(std::floor(POS.y) - PWINDOW->m_uSurface.xwayland->y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) {
|
if (abs(std::floor(POS.x) - PWINDOW->m_uSurface.xwayland->x) > 2 || abs(std::floor(POS.y) - PWINDOW->m_uSurface.xwayland->y) > 2 ||
|
||||||
Debug::log(LOG, "Unmanaged window %x requests geometry update to %i %i %i %i", PWINDOW, (int)PWINDOW->m_uSurface.xwayland->x, (int)PWINDOW->m_uSurface.xwayland->y, (int)PWINDOW->m_uSurface.xwayland->width, (int)PWINDOW->m_uSurface.xwayland->height);
|
abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) {
|
||||||
|
Debug::log(LOG, "Unmanaged window %x requests geometry update to %i %i %i %i", PWINDOW, (int)PWINDOW->m_uSurface.xwayland->x, (int)PWINDOW->m_uSurface.xwayland->y,
|
||||||
|
(int)PWINDOW->m_uSurface.xwayland->width, (int)PWINDOW->m_uSurface.xwayland->height);
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y));
|
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y));
|
||||||
@ -886,7 +900,8 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
|
|||||||
if (XWSURFACE->parent)
|
if (XWSURFACE->parent)
|
||||||
Debug::log(LOG, "Window parent data: %s at %x", XWSURFACE->parent->_class, XWSURFACE->parent);
|
Debug::log(LOG, "Window parent data: %s at %x", XWSURFACE->parent->_class, XWSURFACE->parent);
|
||||||
|
|
||||||
const auto PNEWWINDOW = XWSURFACE->override_redirect ? g_pCompositor->m_dUnmanagedX11Windows.emplace_back(std::make_unique<CWindow>()).get() : g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
|
const auto PNEWWINDOW = XWSURFACE->override_redirect ? g_pCompositor->m_dUnmanagedX11Windows.emplace_back(std::make_unique<CWindow>()).get() :
|
||||||
|
g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
|
||||||
|
|
||||||
PNEWWINDOW->m_uSurface.xwayland = XWSURFACE;
|
PNEWWINDOW->m_uSurface.xwayland = XWSURFACE;
|
||||||
PNEWWINDOW->m_iX11Type = XWSURFACE->override_redirect ? 2 : 1;
|
PNEWWINDOW->m_iX11Type = XWSURFACE->override_redirect ? 2 : 1;
|
||||||
@ -931,7 +946,8 @@ void Events::listener_requestMaximize(void* owner, void* data) {
|
|||||||
if (!PWINDOW->m_bIsX11) {
|
if (!PWINDOW->m_bIsX11) {
|
||||||
const auto EV = (wlr_foreign_toplevel_handle_v1_maximized_event*)data;
|
const auto EV = (wlr_foreign_toplevel_handle_v1_maximized_event*)data;
|
||||||
|
|
||||||
g_pCompositor->setWindowFullscreen(PWINDOW, EV ? EV->maximized : !PWINDOW->m_bIsFullscreen, FULLSCREEN_MAXIMIZED); // this will be rejected if there already is a fullscreen window
|
g_pCompositor->setWindowFullscreen(PWINDOW, EV ? EV->maximized : !PWINDOW->m_bIsFullscreen,
|
||||||
|
FULLSCREEN_MAXIMIZED); // this will be rejected if there already is a fullscreen window
|
||||||
|
|
||||||
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
|
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,9 +38,7 @@ void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, SAnimationPro
|
|||||||
m_cGoal = V;
|
m_cGoal = V;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: ASSERT(false); break;
|
||||||
ASSERT(false);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
Debug::log(ERR, "CAnimatedVariable create error: %s", e.what());
|
Debug::log(ERR, "CAnimatedVariable create error: %s", e.what());
|
||||||
@ -64,7 +62,8 @@ void CAnimatedVariable::registerVar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CAnimatedVariable::getDurationLeftMs() {
|
int CAnimatedVariable::getDurationLeftMs() {
|
||||||
return std::max((int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0);
|
return std::max(
|
||||||
|
(int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float CAnimatedVariable::getPercent() {
|
float CAnimatedVariable::getPercent() {
|
||||||
|
@ -3,14 +3,16 @@
|
|||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include <any>
|
#include <any>
|
||||||
|
|
||||||
enum ANIMATEDVARTYPE {
|
enum ANIMATEDVARTYPE
|
||||||
|
{
|
||||||
AVARTYPE_INVALID = -1,
|
AVARTYPE_INVALID = -1,
|
||||||
AVARTYPE_FLOAT,
|
AVARTYPE_FLOAT,
|
||||||
AVARTYPE_VECTOR,
|
AVARTYPE_VECTOR,
|
||||||
AVARTYPE_COLOR
|
AVARTYPE_COLOR
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AVARDAMAGEPOLICY {
|
enum AVARDAMAGEPOLICY
|
||||||
|
{
|
||||||
AVARDAMAGE_INVALID = -1,
|
AVARDAMAGE_INVALID = -1,
|
||||||
AVARDAMAGE_ENTIRE = 0,
|
AVARDAMAGE_ENTIRE = 0,
|
||||||
AVARDAMAGE_BORDER,
|
AVARDAMAGE_BORDER,
|
||||||
@ -65,28 +67,34 @@ public:
|
|||||||
return m_cGoal;
|
return m_cGoal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator=(const Vector2D& v) {
|
CAnimatedVariable& operator=(const Vector2D& v) {
|
||||||
m_vGoal = v;
|
m_vGoal = v;
|
||||||
animationBegin = std::chrono::system_clock::now();
|
animationBegin = std::chrono::system_clock::now();
|
||||||
m_vBegun = m_vValue;
|
m_vBegun = m_vValue;
|
||||||
|
|
||||||
onAnimationBegin();
|
onAnimationBegin();
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator=(const float& v) {
|
CAnimatedVariable& operator=(const float& v) {
|
||||||
m_fGoal = v;
|
m_fGoal = v;
|
||||||
animationBegin = std::chrono::system_clock::now();
|
animationBegin = std::chrono::system_clock::now();
|
||||||
m_fBegun = m_fValue;
|
m_fBegun = m_fValue;
|
||||||
|
|
||||||
onAnimationBegin();
|
onAnimationBegin();
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator=(const CColor& v) {
|
CAnimatedVariable& operator=(const CColor& v) {
|
||||||
m_cGoal = v;
|
m_cGoal = v;
|
||||||
animationBegin = std::chrono::system_clock::now();
|
animationBegin = std::chrono::system_clock::now();
|
||||||
m_cBegun = m_cValue;
|
m_cBegun = m_cValue;
|
||||||
|
|
||||||
onAnimationBegin();
|
onAnimationBegin();
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the actual stored value, without affecting the goal, but resets the timer
|
// Sets the actual stored value, without affecting the goal, but resets the timer
|
||||||
@ -137,14 +145,10 @@ public:
|
|||||||
// checks if an animation is in progress
|
// checks if an animation is in progress
|
||||||
bool isBeingAnimated() {
|
bool isBeingAnimated() {
|
||||||
switch (m_eVarType) {
|
switch (m_eVarType) {
|
||||||
case AVARTYPE_FLOAT:
|
case AVARTYPE_FLOAT: return m_fValue != m_fGoal;
|
||||||
return m_fValue != m_fGoal;
|
case AVARTYPE_VECTOR: return m_vValue != m_vGoal;
|
||||||
case AVARTYPE_VECTOR:
|
case AVARTYPE_COLOR: return m_cValue != m_cGoal;
|
||||||
return m_vValue != m_vGoal;
|
default: UNREACHABLE();
|
||||||
case AVARTYPE_COLOR:
|
|
||||||
return m_cValue != m_cGoal;
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
@ -166,8 +170,7 @@ public:
|
|||||||
m_cValue = m_cGoal;
|
m_cValue = m_cGoal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: UNREACHABLE();
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endCallback)
|
if (endCallback)
|
||||||
@ -214,7 +217,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Vector2D m_vValue = Vector2D(0, 0);
|
Vector2D m_vValue = Vector2D(0, 0);
|
||||||
float m_fValue = 0;
|
float m_fValue = 0;
|
||||||
CColor m_cValue;
|
CColor m_cValue;
|
||||||
|
@ -29,9 +29,8 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
|
|||||||
getYForPoint(i);
|
getYForPoint(i);
|
||||||
const auto ELAPSEDCALCAVG = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGINCALC).count() / 1000.f / 10.f;
|
const auto ELAPSEDCALCAVG = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGINCALC).count() / 1000.f / 10.f;
|
||||||
|
|
||||||
Debug::log(LOG, "Created a bezier curve, baked %i points, mem usage: %.2fkB, time to bake: %.2fµs. Estimated average calc time: %.2fµs.",
|
Debug::log(LOG, "Created a bezier curve, baked %i points, mem usage: %.2fkB, time to bake: %.2fµs. Estimated average calc time: %.2fµs.", BAKEDPOINTS, POINTSSIZE, ELAPSEDUS,
|
||||||
BAKEDPOINTS, POINTSSIZE, ELAPSEDUS, ELAPSEDCALCAVG);
|
ELAPSEDCALCAVG);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float CBezierCurve::getYForT(float t) {
|
float CBezierCurve::getYForT(float t) {
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
#if defined(__DragonFly__) || defined(__FreeBSD__) || \
|
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#if defined(__DragonFly__)
|
#if defined(__DragonFly__)
|
||||||
#include <sys/kinfo.h> // struct kinfo_proc
|
#include <sys/kinfo.h> // struct kinfo_proc
|
||||||
@ -87,7 +86,7 @@ std::string absolutePath(const std::string& rawpath, const std::string& currentP
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
|
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, const std::string& ownerString) {
|
||||||
ASSERT(pSignal);
|
ASSERT(pSignal);
|
||||||
ASSERT(pListener);
|
ASSERT(pListener);
|
||||||
|
|
||||||
@ -127,8 +126,7 @@ std::string escapeJSONStrings(const std::string& str) {
|
|||||||
case '\t': oss << "\\t"; break;
|
case '\t': oss << "\\t"; break;
|
||||||
default:
|
default:
|
||||||
if ('\x00' <= c && c <= '\x1f') {
|
if ('\x00' <= c && c <= '\x1f') {
|
||||||
oss << "\\u"
|
oss << "\\u" << std::hex << std::setw(4) << std::setfill('0') << static_cast<int>(c);
|
||||||
<< std::hex << std::setw(4) << std::setfill('0') << static_cast<int>(c);
|
|
||||||
} else {
|
} else {
|
||||||
oss << c;
|
oss << c;
|
||||||
}
|
}
|
||||||
@ -166,9 +164,9 @@ std::string removeBeginEndSpacesTabs(std::string str) {
|
|||||||
float getPlusMinusKeywordResult(std::string source, float relative) {
|
float getPlusMinusKeywordResult(std::string source, float relative) {
|
||||||
float result = INT_MAX;
|
float result = INT_MAX;
|
||||||
|
|
||||||
if (source.find_first_of("+") == 0) {
|
if (source[0] == '+') {
|
||||||
try {
|
try {
|
||||||
if (source.contains("."))
|
if (source.contains('.'))
|
||||||
result = relative + std::stof(source.substr(1));
|
result = relative + std::stof(source.substr(1));
|
||||||
else
|
else
|
||||||
result = relative + std::stoi(source.substr(1));
|
result = relative + std::stoi(source.substr(1));
|
||||||
@ -176,9 +174,9 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
|
|||||||
Debug::log(ERR, "Invalid arg \"%s\" in getPlusMinusKeywordResult!", source.c_str());
|
Debug::log(ERR, "Invalid arg \"%s\" in getPlusMinusKeywordResult!", source.c_str());
|
||||||
return INT_MAX;
|
return INT_MAX;
|
||||||
}
|
}
|
||||||
} else if (source.find_first_of("-") == 0) {
|
} else if (source[0] == '-') {
|
||||||
try {
|
try {
|
||||||
if (source.contains("."))
|
if (source.contains('.'))
|
||||||
result = relative - std::stof(source.substr(1));
|
result = relative - std::stof(source.substr(1));
|
||||||
else
|
else
|
||||||
result = relative - std::stoi(source.substr(1));
|
result = relative - std::stoi(source.substr(1));
|
||||||
@ -188,7 +186,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (source.contains("."))
|
if (source.contains('.'))
|
||||||
result = stof(source);
|
result = stof(source);
|
||||||
else
|
else
|
||||||
result = stoi(source);
|
result = stoi(source);
|
||||||
@ -453,9 +451,7 @@ int64_t getPPIDof(int64_t pid) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return std::stoll(pidstr);
|
return std::stoll(pidstr);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) { return 0; }
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +460,7 @@ int64_t configStringToInt(const std::string& VALUE) {
|
|||||||
// Values with 0x are hex
|
// Values with 0x are hex
|
||||||
const auto VALUEWITHOUTHEX = VALUE.substr(2);
|
const auto VALUEWITHOUTHEX = VALUE.substr(2);
|
||||||
return stol(VALUEWITHOUTHEX, nullptr, 16);
|
return stol(VALUEWITHOUTHEX, nullptr, 16);
|
||||||
} else if (VALUE.find("rgba(") == 0 && VALUE.find(")") == VALUE.length() - 1) {
|
} else if (VALUE.find("rgba(") == 0 && VALUE.find(')') == VALUE.length() - 1) {
|
||||||
const auto VALUEWITHOUTFUNC = VALUE.substr(5, VALUE.length() - 6);
|
const auto VALUEWITHOUTFUNC = VALUE.substr(5, VALUE.length() - 6);
|
||||||
|
|
||||||
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 8) {
|
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 8) {
|
||||||
@ -476,7 +472,7 @@ int64_t configStringToInt(const std::string& VALUE) {
|
|||||||
|
|
||||||
// now we need to RGBA -> ARGB. The config holds ARGB only.
|
// now we need to RGBA -> ARGB. The config holds ARGB only.
|
||||||
return (RGBA >> 8) + 0x1000000 * (RGBA & 0xFF);
|
return (RGBA >> 8) + 0x1000000 * (RGBA & 0xFF);
|
||||||
} else if (VALUE.find("rgb(") == 0 && VALUE.find(")") == VALUE.length() - 1) {
|
} else if (VALUE.find("rgb(") == 0 && VALUE.find(')') == VALUE.length() - 1) {
|
||||||
const auto VALUEWITHOUTFUNC = VALUE.substr(4, VALUE.length() - 5);
|
const auto VALUEWITHOUTFUNC = VALUE.substr(4, VALUE.length() - 5);
|
||||||
|
|
||||||
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 6) {
|
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 6) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "../includes.hpp"
|
#include "../includes.hpp"
|
||||||
|
|
||||||
std::string absolutePath(const std::string&, const std::string&);
|
std::string absolutePath(const std::string&, const std::string&);
|
||||||
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, std::string ownerString);
|
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString);
|
||||||
std::string getFormat(const char* fmt, ...); // Basically Debug::log to a string
|
std::string getFormat(const char* fmt, ...); // Basically Debug::log to a string
|
||||||
std::string escapeJSONStrings(const std::string& str);
|
std::string escapeJSONStrings(const std::string& str);
|
||||||
void scaleBox(wlr_box*, float);
|
void scaleBox(wlr_box*, float);
|
||||||
|
@ -110,7 +110,8 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
|
|
||||||
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, scale);
|
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, scale);
|
||||||
|
|
||||||
Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", output->name, (int)vecPosition.x, (int)vecPosition.y, (int)vecPixelSize.x, (int)vecPixelSize.y, output);
|
Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", output->name, (int)vecPosition.x, (int)vecPosition.y, (int)vecPixelSize.x,
|
||||||
|
(int)vecPixelSize.y, output);
|
||||||
|
|
||||||
damage = wlr_output_damage_create(output);
|
damage = wlr_output_damage_create(output);
|
||||||
|
|
||||||
@ -206,7 +207,8 @@ void CMonitor::onDisconnect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// snap cursor
|
// snap cursor
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f);
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f,
|
||||||
|
BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f);
|
||||||
|
|
||||||
// move workspaces
|
// move workspaces
|
||||||
std::deque<CWorkspace*> wspToMove;
|
std::deque<CWorkspace*> wspToMove;
|
||||||
@ -347,7 +349,8 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()) {
|
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) ==
|
||||||
|
g_pCompositor->m_vMonitors.end()) {
|
||||||
g_pCompositor->m_vMonitors.push_back(*m_pThisWrap);
|
g_pCompositor->m_vMonitors.push_back(*m_pThisWrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,9 +390,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
|||||||
pMirrorOf->mirrors.push_back(this);
|
pMirrorOf->mirrors.push_back(this);
|
||||||
|
|
||||||
// remove from mvmonitors
|
// remove from mvmonitors
|
||||||
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) != g_pCompositor->m_vMonitors.end()) {
|
std::erase_if(g_pCompositor->m_vMonitors, [&](const auto& other) { return other.get() == this; });
|
||||||
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](const auto& other) { return other.get() == this; }));
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pCompositor->setActiveMonitor(g_pCompositor->m_vMonitors.front().get());
|
g_pCompositor->setActiveMonitor(g_pCompositor->m_vMonitors.front().get());
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ public:
|
|||||||
// I don't really care lol :P
|
// I don't really care lol :P
|
||||||
wlr_ext_workspace_group_handle_v1* pWLRWorkspaceGroupHandle = nullptr;
|
wlr_ext_workspace_group_handle_v1* pWLRWorkspaceGroupHandle = nullptr;
|
||||||
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void onConnect(bool noRule);
|
void onConnect(bool noRule);
|
||||||
void onDisconnect();
|
void onDisconnect();
|
||||||
|
@ -178,7 +178,8 @@ void Events::listener_unmapSubsurface(void* owner, void* data) {
|
|||||||
if (subsurface->pChild) {
|
if (subsurface->pChild) {
|
||||||
const auto PNODE = subsurface->pChild;
|
const auto PNODE = subsurface->pChild;
|
||||||
|
|
||||||
const auto IT = std::find_if(SubsurfaceTree::surfaceTreeNodes.begin(), SubsurfaceTree::surfaceTreeNodes.end(), [&](const SSurfaceTreeNode& other) { return &other == PNODE; });
|
const auto IT =
|
||||||
|
std::find_if(SubsurfaceTree::surfaceTreeNodes.begin(), SubsurfaceTree::surfaceTreeNodes.end(), [&](const SSurfaceTreeNode& other) { return &other == PNODE; });
|
||||||
|
|
||||||
if (IT != SubsurfaceTree::surfaceTreeNodes.end()) {
|
if (IT != SubsurfaceTree::surfaceTreeNodes.end()) {
|
||||||
int lx = 0, ly = 0;
|
int lx = 0, ly = 0;
|
||||||
@ -216,7 +217,8 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
|
|||||||
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
|
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
|
||||||
// What this does is that basically, if the pNode is a child of some other node, on commit,
|
// What this does is that basically, if the pNode is a child of some other node, on commit,
|
||||||
// it will also damage (check & damage if needed) all its siblings.
|
// it will also damage (check & damage if needed) all its siblings.
|
||||||
if (pNode->pParent) for (auto& cs : pNode->pParent->childSubsurfaces) {
|
if (pNode->pParent)
|
||||||
|
for (auto& cs : pNode->pParent->childSubsurfaces) {
|
||||||
const auto NODECOORDS = pNode->pSubsurface ? Vector2D(pNode->pSubsurface->pSubsurface->current.x, pNode->pSubsurface->pSubsurface->current.y) : Vector2D();
|
const auto NODECOORDS = pNode->pSubsurface ? Vector2D(pNode->pSubsurface->pSubsurface->current.x, pNode->pSubsurface->pSubsurface->current.y) : Vector2D();
|
||||||
|
|
||||||
if (&cs != pNode->pSubsurface && cs.pSubsurface) {
|
if (&cs != pNode->pSubsurface && cs.pSubsurface) {
|
||||||
|
@ -6,7 +6,11 @@ Vector2D::Vector2D(double xx, double yy) {
|
|||||||
y = yy;
|
y = yy;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D::Vector2D() { x = 0; y = 0; }
|
Vector2D::Vector2D() {
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Vector2D::~Vector2D() {}
|
Vector2D::~Vector2D() {}
|
||||||
|
|
||||||
double Vector2D::normalize() {
|
double Vector2D::normalize() {
|
||||||
@ -24,8 +28,5 @@ Vector2D Vector2D::floor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector2D Vector2D::clamp(const Vector2D& min, const Vector2D& max) {
|
Vector2D Vector2D::clamp(const Vector2D& min, const Vector2D& max) {
|
||||||
return Vector2D(
|
return Vector2D(std::clamp(this->x, min.x, max.x == 0 ? INFINITY : max.x), std::clamp(this->y, min.y, max.y == 0 ? INFINITY : max.y));
|
||||||
std::clamp(this->x, min.x, max.x == 0 ? INFINITY : max.x),
|
|
||||||
std::clamp(this->y, min.y, max.y == 0 ? INFINITY : max.y)
|
|
||||||
);
|
|
||||||
}
|
}
|
@ -14,16 +14,16 @@ class Vector2D {
|
|||||||
// returns the scale
|
// returns the scale
|
||||||
double normalize();
|
double normalize();
|
||||||
|
|
||||||
Vector2D operator+(const Vector2D a) const {
|
Vector2D operator+(const Vector2D& a) const {
|
||||||
return Vector2D(this->x + a.x, this->y + a.y);
|
return Vector2D(this->x + a.x, this->y + a.y);
|
||||||
}
|
}
|
||||||
Vector2D operator-(const Vector2D a) const {
|
Vector2D operator-(const Vector2D& a) const {
|
||||||
return Vector2D(this->x - a.x, this->y - a.y);
|
return Vector2D(this->x - a.x, this->y - a.y);
|
||||||
}
|
}
|
||||||
Vector2D operator*(const float a) const {
|
Vector2D operator*(const float& a) const {
|
||||||
return Vector2D(this->x * a, this->y * a);
|
return Vector2D(this->x * a, this->y * a);
|
||||||
}
|
}
|
||||||
Vector2D operator/(const float a) const {
|
Vector2D operator/(const float& a) const {
|
||||||
return Vector2D(this->x / a, this->y / a);
|
return Vector2D(this->x / a, this->y / a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,11 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_vRenderOffset.m_pWorkspace = this;
|
m_vRenderOffset.m_pWorkspace = this;
|
||||||
m_vRenderOffset.create(AVARTYPE_VECTOR, special ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"), nullptr, AVARDAMAGE_ENTIRE);
|
m_vRenderOffset.create(AVARTYPE_VECTOR, special ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"),
|
||||||
|
nullptr, AVARDAMAGE_ENTIRE);
|
||||||
m_fAlpha.m_pWorkspace = this;
|
m_fAlpha.m_pWorkspace = this;
|
||||||
m_fAlpha.create(AVARTYPE_FLOAT, special ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"), nullptr, AVARDAMAGE_ENTIRE);
|
m_fAlpha.create(AVARTYPE_FLOAT, special ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"),
|
||||||
|
nullptr, AVARDAMAGE_ENTIRE);
|
||||||
m_fAlpha.setValueAndWarp(255.f);
|
m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
|
||||||
m_vRenderOffset.registerVar();
|
m_vRenderOffset.registerVar();
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "AnimatedVariable.hpp"
|
#include "AnimatedVariable.hpp"
|
||||||
|
|
||||||
enum eFullscreenMode : uint8_t {
|
enum eFullscreenMode : uint8_t
|
||||||
|
{
|
||||||
FULLSCREEN_FULL = 0,
|
FULLSCREEN_FULL = 0,
|
||||||
FULLSCREEN_MAXIMIZED
|
FULLSCREEN_MAXIMIZED
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,8 @@ typedef struct {
|
|||||||
} xcb_size_hints_t;
|
} xcb_size_hints_t;
|
||||||
typedef unsigned int xcb_window_t;
|
typedef unsigned int xcb_window_t;
|
||||||
|
|
||||||
typedef enum xcb_stack_mode_t {
|
typedef enum xcb_stack_mode_t
|
||||||
|
{
|
||||||
XCB_STACK_MODE_ABOVE = 0,
|
XCB_STACK_MODE_ABOVE = 0,
|
||||||
XCB_STACK_MODE_BELOW = 1,
|
XCB_STACK_MODE_BELOW = 1,
|
||||||
XCB_STACK_MODE_TOP_IF = 2,
|
XCB_STACK_MODE_TOP_IF = 2,
|
||||||
@ -142,13 +143,17 @@ inline void wlr_xwayland_destroy(wlr_xwayland*) { }
|
|||||||
|
|
||||||
inline void wlr_xwayland_surface_configure(wlr_xwayland_surface*, int, int, int, int) {}
|
inline void wlr_xwayland_surface_configure(wlr_xwayland_surface*, int, int, int, int) {}
|
||||||
|
|
||||||
inline bool wlr_surface_is_xwayland_surface(void*) { return false; }
|
inline bool wlr_surface_is_xwayland_surface(void*) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
inline void wlr_xwayland_surface_activate(wlr_xwayland_surface*, bool) {}
|
inline void wlr_xwayland_surface_activate(wlr_xwayland_surface*, bool) {}
|
||||||
|
|
||||||
inline void wlr_xwayland_surface_restack(wlr_xwayland_surface*, int, xcb_stack_mode_t) {}
|
inline void wlr_xwayland_surface_restack(wlr_xwayland_surface*, int, xcb_stack_mode_t) {}
|
||||||
|
|
||||||
inline wlr_xwayland_surface* wlr_xwayland_surface_from_wlr_surface(void*) { return nullptr; }
|
inline wlr_xwayland_surface* wlr_xwayland_surface_from_wlr_surface(void*) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
inline void wlr_xwayland_surface_close(wlr_xwayland_surface*) {}
|
inline void wlr_xwayland_surface_close(wlr_xwayland_surface*) {}
|
||||||
|
|
||||||
@ -156,6 +161,8 @@ inline void wlr_xwayland_surface_set_fullscreen(wlr_xwayland_surface*, bool) { }
|
|||||||
|
|
||||||
inline void wlr_xwayland_surface_set_minimized(wlr_xwayland_surface*, bool) {}
|
inline void wlr_xwayland_surface_set_minimized(wlr_xwayland_surface*, bool) {}
|
||||||
|
|
||||||
inline bool wlr_backend_is_x11(void*) { return false; }
|
inline bool wlr_backend_is_x11(void*) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
inline void wlr_x11_output_create(void*) {}
|
inline void wlr_x11_output_create(void*) {}
|
@ -57,7 +57,6 @@ void CHyprError::createQueued() {
|
|||||||
yoffset += FONTSIZE + (FONTSIZE / 10.f);
|
yoffset += FONTSIZE + (FONTSIZE / 10.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cairo_surface_flush(CAIROSURFACE);
|
cairo_surface_flush(CAIROSURFACE);
|
||||||
|
|
||||||
// copy the data to an OpenGL texture we have
|
// copy the data to an OpenGL texture we have
|
||||||
|
@ -188,7 +188,9 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
|||||||
|
|
||||||
const auto NODESONWORKSPACE = getNodesOnWorkspace(PWINDOW->m_iWorkspaceID);
|
const auto NODESONWORKSPACE = getNodesOnWorkspace(PWINDOW->m_iWorkspaceID);
|
||||||
|
|
||||||
if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && (NODESONWORKSPACE == 1 || (pNode->isGroupMember() && pNode->getGroupMemberCount() == NODESONWORKSPACE) || (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) {
|
if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) &&
|
||||||
|
(NODESONWORKSPACE == 1 || (pNode->isGroupMember() && pNode->getGroupMemberCount() == NODESONWORKSPACE) ||
|
||||||
|
(PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) {
|
||||||
PWINDOW->m_vRealPosition = calcPos - Vector2D(*PBORDERSIZE, *PBORDERSIZE);
|
PWINDOW->m_vRealPosition = calcPos - Vector2D(*PBORDERSIZE, *PBORDERSIZE);
|
||||||
PWINDOW->m_vRealSize = calcSize + Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE);
|
PWINDOW->m_vRealSize = calcSize + Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE);
|
||||||
|
|
||||||
@ -205,11 +207,9 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
|||||||
PWINDOW->m_sSpecialRenderData.border = true;
|
PWINDOW->m_sSpecialRenderData.border = true;
|
||||||
PWINDOW->m_sSpecialRenderData.decorate = true;
|
PWINDOW->m_sSpecialRenderData.decorate = true;
|
||||||
|
|
||||||
const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? *PGAPSOUT : *PGAPSIN,
|
const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? *PGAPSOUT : *PGAPSIN, DISPLAYTOP ? *PGAPSOUT : *PGAPSIN);
|
||||||
DISPLAYTOP ? *PGAPSOUT : *PGAPSIN);
|
|
||||||
|
|
||||||
const auto OFFSETBOTTOMRIGHT = Vector2D(DISPLAYRIGHT ? *PGAPSOUT : *PGAPSIN,
|
const auto OFFSETBOTTOMRIGHT = Vector2D(DISPLAYRIGHT ? *PGAPSOUT : *PGAPSIN, DISPLAYBOTTOM ? *PGAPSOUT : *PGAPSIN);
|
||||||
DISPLAYBOTTOM ? *PGAPSOUT : *PGAPSIN);
|
|
||||||
|
|
||||||
calcPos = calcPos + OFFSETTOPLEFT;
|
calcPos = calcPos + OFFSETTOPLEFT;
|
||||||
calcSize = calcSize - OFFSETTOPLEFT - OFFSETBOTTOMRIGHT;
|
calcSize = calcSize - OFFSETTOPLEFT - OFFSETBOTTOMRIGHT;
|
||||||
@ -293,7 +293,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
|
|||||||
SDwindleNodeData* OPENINGON;
|
SDwindleNodeData* OPENINGON;
|
||||||
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor();
|
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor();
|
||||||
|
|
||||||
if (PMONITOR->ID == MONFROMCURSOR->ID && (PNODE->workspaceID == PMONITOR->activeWorkspace || (g_pCompositor->isWorkspaceSpecial(PNODE->workspaceID) && PMONITOR->specialWorkspaceID)) && !*PUSEACTIVE) {
|
if (PMONITOR->ID == MONFROMCURSOR->ID &&
|
||||||
|
(PNODE->workspaceID == PMONITOR->activeWorkspace || (g_pCompositor->isWorkspaceSpecial(PNODE->workspaceID) && PMONITOR->specialWorkspaceID)) && !*PUSEACTIVE) {
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
||||||
|
|
||||||
// happens on reserved area
|
// happens on reserved area
|
||||||
@ -301,7 +302,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
|
|||||||
OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
|
OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
|
||||||
} else if (*PUSEACTIVE) {
|
} else if (*PUSEACTIVE) {
|
||||||
if (g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow && g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) {
|
if (g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow &&
|
||||||
|
g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) {
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow);
|
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow);
|
||||||
} else {
|
} else {
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
||||||
@ -403,8 +405,12 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
|
|||||||
const auto PFORCESPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:force_split")->intValue;
|
const auto PFORCESPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:force_split")->intValue;
|
||||||
|
|
||||||
if (*PFORCESPLIT == 0) {
|
if (*PFORCESPLIT == 0) {
|
||||||
if ((SIDEBYSIDE && VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y / *PWIDTHMULTIPLIER, NEWPARENT->position.x + NEWPARENT->size.x / 2.f, NEWPARENT->position.y + NEWPARENT->size.y))
|
if ((SIDEBYSIDE &&
|
||||||
|| (!SIDEBYSIDE && VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y / *PWIDTHMULTIPLIER, NEWPARENT->position.x + NEWPARENT->size.x, NEWPARENT->position.y + NEWPARENT->size.y / 2.f))) {
|
VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y / *PWIDTHMULTIPLIER, NEWPARENT->position.x + NEWPARENT->size.x / 2.f,
|
||||||
|
NEWPARENT->position.y + NEWPARENT->size.y)) ||
|
||||||
|
(!SIDEBYSIDE &&
|
||||||
|
VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y / *PWIDTHMULTIPLIER, NEWPARENT->position.x + NEWPARENT->size.x,
|
||||||
|
NEWPARENT->position.y + NEWPARENT->size.y / 2.f))) {
|
||||||
// we are hovering over the first node, make PNODE first.
|
// we are hovering over the first node, make PNODE first.
|
||||||
NEWPARENT->children[1] = OPENINGON;
|
NEWPARENT->children[1] = OPENINGON;
|
||||||
NEWPARENT->children[0] = PNODE;
|
NEWPARENT->children[0] = PNODE;
|
||||||
@ -434,7 +440,6 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
|
|||||||
|
|
||||||
// Update the children
|
// Update the children
|
||||||
|
|
||||||
|
|
||||||
if (NEWPARENT->size.x * *PWIDTHMULTIPLIER > NEWPARENT->size.y) {
|
if (NEWPARENT->size.x * *PWIDTHMULTIPLIER > NEWPARENT->size.y) {
|
||||||
// split left/right
|
// split left/right
|
||||||
OPENINGON->position = NEWPARENT->position;
|
OPENINGON->position = NEWPARENT->position;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
||||||
|
#include <array>
|
||||||
|
|
||||||
class CHyprDwindleLayout;
|
class CHyprDwindleLayout;
|
||||||
enum eFullscreenMode : uint8_t;
|
enum eFullscreenMode : uint8_t;
|
||||||
@ -33,7 +34,8 @@ struct SDwindleNodeData {
|
|||||||
|
|
||||||
// For list lookup
|
// For list lookup
|
||||||
bool operator==(const SDwindleNodeData& rhs) {
|
bool operator==(const SDwindleNodeData& rhs) {
|
||||||
return pWindow == rhs.pWindow && workspaceID == rhs.workspaceID && position == rhs.position && size == rhs.size && pParent == rhs.pParent && children[0] == rhs.children[0] && children[1] == rhs.children[1];
|
return pWindow == rhs.pWindow && workspaceID == rhs.workspaceID && position == rhs.position && size == rhs.size && pParent == rhs.pParent &&
|
||||||
|
children[0] == rhs.children[0] && children[1] == rhs.children[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void recalcSizePosRecursive(bool force = false);
|
void recalcSizePosRecursive(bool force = false);
|
||||||
@ -65,7 +67,6 @@ public:
|
|||||||
virtual void onDisable();
|
virtual void onDisable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::list<SDwindleNodeData> m_lDwindleNodesData;
|
std::list<SDwindleNodeData> m_lDwindleNodesData;
|
||||||
|
|
||||||
int getNodesOnWorkspace(const int&);
|
int getNodesOnWorkspace(const int&);
|
||||||
|
@ -52,7 +52,8 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
|||||||
const auto PWINDOWSURFACE = g_pXWaylandManager->getWindowSurface(pWindow);
|
const auto PWINDOWSURFACE = g_pXWaylandManager->getWindowSurface(pWindow);
|
||||||
pWindow->m_vRealSize = Vector2D(PWINDOWSURFACE->current.width, PWINDOWSURFACE->current.height);
|
pWindow->m_vRealSize = Vector2D(PWINDOWSURFACE->current.width, PWINDOWSURFACE->current.height);
|
||||||
|
|
||||||
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 && pWindow->m_iX11Type == 2) { // XDG windows should be fine. TODO: check for weird atoms?
|
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 &&
|
||||||
|
pWindow->m_iX11Type == 2) { // XDG windows should be fine. TODO: check for weird atoms?
|
||||||
pWindow->setHidden(true);
|
pWindow->setHidden(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,7 +63,8 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
|||||||
pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
|
pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goalv().x) / 2.f, PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goalv().y) / 2.f);
|
pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goalv().x) / 2.f,
|
||||||
|
PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goalv().y) / 2.f);
|
||||||
} else {
|
} else {
|
||||||
// we respect the size.
|
// we respect the size.
|
||||||
pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
|
pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
|
||||||
@ -75,10 +77,14 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
|||||||
|
|
||||||
if (!pWindow->m_bIsX11) {
|
if (!pWindow->m_bIsX11) {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)
|
if (VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x,
|
||||||
|| VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)
|
m->vecPosition.y + m->vecPosition.y) ||
|
||||||
|| VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)
|
VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x,
|
||||||
|| VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)) {
|
m->vecPosition.y + m->vecPosition.y) ||
|
||||||
|
VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x,
|
||||||
|
m->vecPosition.y + m->vecPosition.y) ||
|
||||||
|
VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y,
|
||||||
|
m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)) {
|
||||||
|
|
||||||
visible = true;
|
visible = true;
|
||||||
break;
|
break;
|
||||||
@ -389,8 +395,10 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
|||||||
|
|
||||||
// find whether there is a floating window below this one
|
// find whether there is a floating window below this one
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus && !w->m_bNoFocus) {
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus &&
|
||||||
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x, w->m_vPosition.y + w->m_vSize.y)) {
|
!w->m_bNoFocus) {
|
||||||
|
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
|
||||||
|
w->m_vPosition.y + w->m_vSize.y)) {
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,7 +414,8 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
|||||||
|
|
||||||
// if not, floating window
|
// if not, floating window
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus && !w->m_bNoFocus)
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus &&
|
||||||
|
!w->m_bNoFocus)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,11 +426,11 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
|||||||
// if it was a tiled window, we first try to find the window that will replace it.
|
// if it was a tiled window, we first try to find the window that will replace it.
|
||||||
const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(pWindow->m_vRealPosition.goalv() + pWindow->m_vRealSize.goalv() / 2.f);
|
const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(pWindow->m_vRealPosition.goalv() + pWindow->m_vRealSize.goalv() / 2.f);
|
||||||
|
|
||||||
if (!PWINDOWCANDIDATE || pWindow == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->isHidden() || PWINDOWCANDIDATE->m_bX11ShouldntFocus || PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
|
if (!PWINDOWCANDIDATE || pWindow == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->isHidden() || PWINDOWCANDIDATE->m_bX11ShouldntFocus ||
|
||||||
|
PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return PWINDOWCANDIDATE;
|
return PWINDOWCANDIDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IHyprLayout::~IHyprLayout() {
|
IHyprLayout::~IHyprLayout() {}
|
||||||
}
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../Window.hpp"
|
#include "../Window.hpp"
|
||||||
|
#include <any>
|
||||||
|
|
||||||
struct SWindowRenderLayoutHints {
|
struct SWindowRenderLayoutHints {
|
||||||
bool isBorderColor = false;
|
bool isBorderColor = false;
|
||||||
|
@ -107,7 +107,8 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow) {
|
|||||||
PNODE->isMaster = false;
|
PNODE->isMaster = false;
|
||||||
|
|
||||||
// first, check if it isn't too big.
|
// first, check if it isn't too big.
|
||||||
if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow); MAXSIZE.x < PMONITOR->vecSize.x * (1 - lastSplitPercent) || MAXSIZE.y < PMONITOR->vecSize.y * (1.f / (WINDOWSONWORKSPACE - 1))) {
|
if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow);
|
||||||
|
MAXSIZE.x < PMONITOR->vecSize.x * (1 - lastSplitPercent) || MAXSIZE.y < PMONITOR->vecSize.y * (1.f / (WINDOWSONWORKSPACE - 1))) {
|
||||||
// we can't continue. make it floating.
|
// we can't continue. make it floating.
|
||||||
pWindow->m_bIsFloating = true;
|
pWindow->m_bIsFloating = true;
|
||||||
m_lMasterNodesData.remove(*PNODE);
|
m_lMasterNodesData.remove(*PNODE);
|
||||||
@ -225,7 +226,8 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
|
|||||||
//compute placement of master window(s)
|
//compute placement of master window(s)
|
||||||
if (getNodesOnWorkspace(PWORKSPACE->m_iID) < 2) {
|
if (getNodesOnWorkspace(PWORKSPACE->m_iID) < 2) {
|
||||||
PMASTERNODE->position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition;
|
PMASTERNODE->position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition;
|
||||||
PMASTERNODE->size = Vector2D(PMONITOR->vecSize.x - PMONITOR->vecReservedTopLeft.x - PMONITOR->vecReservedBottomRight.x, PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y);
|
PMASTERNODE->size = Vector2D(PMONITOR->vecSize.x - PMONITOR->vecReservedTopLeft.x - PMONITOR->vecReservedBottomRight.x,
|
||||||
|
PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y);
|
||||||
applyNodeDataToWindow(PMASTERNODE);
|
applyNodeDataToWindow(PMASTERNODE);
|
||||||
return;
|
return;
|
||||||
} else if (PWORKSPACEDATA->orientation == ORIENTATION_LEFT || PWORKSPACEDATA->orientation == ORIENTATION_RIGHT) {
|
} else if (PWORKSPACEDATA->orientation == ORIENTATION_LEFT || PWORKSPACEDATA->orientation == ORIENTATION_RIGHT) {
|
||||||
@ -280,7 +282,6 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//compute placement of slave window(s)
|
//compute placement of slave window(s)
|
||||||
int slavesLeft = getNodesOnWorkspace(PWORKSPACE->m_iID) - MASTERS;
|
int slavesLeft = getNodesOnWorkspace(PWORKSPACE->m_iID) - MASTERS;
|
||||||
if (PWORKSPACEDATA->orientation == ORIENTATION_LEFT || PWORKSPACEDATA->orientation == ORIENTATION_RIGHT) {
|
if (PWORKSPACEDATA->orientation == ORIENTATION_LEFT || PWORKSPACEDATA->orientation == ORIENTATION_RIGHT) {
|
||||||
@ -293,7 +294,8 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (PWORKSPACEDATA->orientation == ORIENTATION_LEFT) {
|
if (PWORKSPACEDATA->orientation == ORIENTATION_LEFT) {
|
||||||
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition + Vector2D(PMASTERNODE->percMaster * (PMONITOR->vecSize.x - PMONITOR->vecReservedTopLeft.x - PMONITOR->vecReservedBottomRight.x), nextY);
|
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition +
|
||||||
|
Vector2D(PMASTERNODE->percMaster * (PMONITOR->vecSize.x - PMONITOR->vecReservedTopLeft.x - PMONITOR->vecReservedBottomRight.x), nextY);
|
||||||
} else {
|
} else {
|
||||||
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition + Vector2D(0, nextY);
|
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition + Vector2D(0, nextY);
|
||||||
}
|
}
|
||||||
@ -317,7 +319,8 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
|
|||||||
if (nd.workspaceID != PWORKSPACE->m_iID || nd.isMaster)
|
if (nd.workspaceID != PWORKSPACE->m_iID || nd.isMaster)
|
||||||
continue;
|
continue;
|
||||||
if (PWORKSPACEDATA->orientation == ORIENTATION_TOP) {
|
if (PWORKSPACEDATA->orientation == ORIENTATION_TOP) {
|
||||||
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition + Vector2D(nextX, PMASTERNODE->percMaster * (PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y));
|
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition +
|
||||||
|
Vector2D(nextX, PMASTERNODE->percMaster * (PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y));
|
||||||
} else {
|
} else {
|
||||||
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition + Vector2D(nextX, 0);
|
nd.position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition + Vector2D(nextX, 0);
|
||||||
}
|
}
|
||||||
@ -333,8 +336,6 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
|
|||||||
applyNodeDataToWindow(&nd);
|
applyNodeDataToWindow(&nd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
||||||
@ -381,7 +382,9 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
|||||||
auto calcPos = PWINDOW->m_vPosition + Vector2D(*PBORDERSIZE, *PBORDERSIZE);
|
auto calcPos = PWINDOW->m_vPosition + Vector2D(*PBORDERSIZE, *PBORDERSIZE);
|
||||||
auto calcSize = PWINDOW->m_vSize - Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE);
|
auto calcSize = PWINDOW->m_vSize - Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE);
|
||||||
|
|
||||||
if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && (getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) == 1 || (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) {
|
if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) &&
|
||||||
|
(getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) == 1 ||
|
||||||
|
(PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) {
|
||||||
PWINDOW->m_vRealPosition = calcPos - Vector2D(*PBORDERSIZE, *PBORDERSIZE);
|
PWINDOW->m_vRealPosition = calcPos - Vector2D(*PBORDERSIZE, *PBORDERSIZE);
|
||||||
PWINDOW->m_vRealSize = calcSize + Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE);
|
PWINDOW->m_vRealSize = calcSize + Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE);
|
||||||
|
|
||||||
@ -398,11 +401,9 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
|||||||
PWINDOW->m_sSpecialRenderData.border = true;
|
PWINDOW->m_sSpecialRenderData.border = true;
|
||||||
PWINDOW->m_sSpecialRenderData.decorate = true;
|
PWINDOW->m_sSpecialRenderData.decorate = true;
|
||||||
|
|
||||||
const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? *PGAPSOUT : *PGAPSIN,
|
const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? *PGAPSOUT : *PGAPSIN, DISPLAYTOP ? *PGAPSOUT : *PGAPSIN);
|
||||||
DISPLAYTOP ? *PGAPSOUT : *PGAPSIN);
|
|
||||||
|
|
||||||
const auto OFFSETBOTTOMRIGHT = Vector2D(DISPLAYRIGHT ? *PGAPSOUT : *PGAPSIN,
|
const auto OFFSETBOTTOMRIGHT = Vector2D(DISPLAYRIGHT ? *PGAPSOUT : *PGAPSIN, DISPLAYBOTTOM ? *PGAPSOUT : *PGAPSIN);
|
||||||
DISPLAYBOTTOM ? *PGAPSOUT : *PGAPSIN);
|
|
||||||
|
|
||||||
calcPos = calcPos + OFFSETTOPLEFT;
|
calcPos = calcPos + OFFSETTOPLEFT;
|
||||||
calcSize = calcSize - OFFSETTOPLEFT - OFFSETBOTTOMRIGHT;
|
calcSize = calcSize - OFFSETTOPLEFT - OFFSETBOTTOMRIGHT;
|
||||||
@ -732,7 +733,6 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
|||||||
if (!PMASTER)
|
if (!PMASTER)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
if (PMASTER->pWindow != PWINDOW) {
|
if (PMASTER->pWindow != PWINDOW) {
|
||||||
switchWindows(PWINDOW, PMASTER->pWindow);
|
switchWindows(PWINDOW, PMASTER->pWindow);
|
||||||
switchToWindow(PWINDOW);
|
switchToWindow(PWINDOW);
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <any>
|
||||||
|
|
||||||
enum eFullscreenMode : uint8_t;
|
enum eFullscreenMode : uint8_t;
|
||||||
|
|
||||||
//orientation determines which side of the screen the master area resides
|
//orientation determines which side of the screen the master area resides
|
||||||
enum eOrientation : uint8_t {
|
enum eOrientation : uint8_t
|
||||||
|
{
|
||||||
ORIENTATION_LEFT = 0,
|
ORIENTATION_LEFT = 0,
|
||||||
ORIENTATION_TOP,
|
ORIENTATION_TOP,
|
||||||
ORIENTATION_RIGHT,
|
ORIENTATION_RIGHT,
|
||||||
@ -61,7 +63,6 @@ public:
|
|||||||
virtual void onDisable();
|
virtual void onDisable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::list<SMasterNodeData> m_lMasterNodesData;
|
std::list<SMasterNodeData> m_lMasterNodesData;
|
||||||
std::vector<SMasterWorkspaceData> m_lMasterWorkspacesData;
|
std::vector<SMasterWorkspaceData> m_lMasterWorkspacesData;
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ int main(int argc, char** argv) {
|
|||||||
configPath = std::string(argv[++i]);
|
configPath = std::string(argv[++i]);
|
||||||
Debug::log(LOG, "Using config location %s.", configPath.c_str());
|
Debug::log(LOG, "Using config location %s.", configPath.c_str());
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Hyprland usage: Hyprland [arg [...]].\n\nArguments:\n" <<
|
std::cout << "Hyprland usage: Hyprland [arg [...]].\n\nArguments:\n"
|
||||||
"--help -h | Show this help message\n" <<
|
<< "--help -h | Show this help message\n"
|
||||||
"--config -c | Specify config file to use\n";
|
<< "--config -c | Specify config file to use\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,8 @@ void CAnimationManager::tick() {
|
|||||||
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR);
|
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} case AVARDAMAGE_BORDER: {
|
}
|
||||||
|
case AVARDAMAGE_BORDER: {
|
||||||
RASSERT(PWINDOW, "Tried to AVARDAMAGE_BORDER a non-window AVAR!");
|
RASSERT(PWINDOW, "Tried to AVARDAMAGE_BORDER a non-window AVAR!");
|
||||||
|
|
||||||
// damage only the border.
|
// damage only the border.
|
||||||
@ -175,18 +176,21 @@ void CAnimationManager::tick() {
|
|||||||
// damage for old box
|
// damage for old box
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height + 2 * BORDERSIZE); // left
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height + 2 * BORDERSIZE); // left
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x + WLRBOXPREV.width - ROUNDINGSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height + 2 * BORDERSIZE); // right
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x + WLRBOXPREV.width - ROUNDINGSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE,
|
||||||
|
WLRBOXPREV.height + 2 * BORDERSIZE); // right
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x, WLRBOXPREV.y + WLRBOXPREV.height - ROUNDINGSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x, WLRBOXPREV.y + WLRBOXPREV.height - ROUNDINGSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||||
|
|
||||||
// damage for new box
|
// damage for new box
|
||||||
const wlr_box WLRBOXNEW = {PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y};
|
const wlr_box WLRBOXNEW = {PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y};
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // left
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // left
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // right
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE,
|
||||||
|
WLRBOXNEW.height + 2 * BORDERSIZE); // right
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x, WLRBOXNEW.y + WLRBOXNEW.height - ROUNDINGSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x, WLRBOXNEW.y + WLRBOXNEW.height - ROUNDINGSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} case AVARDAMAGE_SHADOW: {
|
}
|
||||||
|
case AVARDAMAGE_SHADOW: {
|
||||||
RASSERT(PWINDOW, "Tried to AVARDAMAGE_SHADOW a non-window AVAR!");
|
RASSERT(PWINDOW, "Tried to AVARDAMAGE_SHADOW a non-window AVAR!");
|
||||||
|
|
||||||
static auto* const PSHADOWIGNOREWINDOW = &g_pConfigManager->getConfigValuePtr("decoration:shadow_ignore_window")->intValue;
|
static auto* const PSHADOWIGNOREWINDOW = &g_pConfigManager->getConfigValuePtr("decoration:shadow_ignore_window")->intValue;
|
||||||
@ -197,7 +201,8 @@ void CAnimationManager::tick() {
|
|||||||
const auto EXTENTS = PDECO->getWindowDecorationExtents();
|
const auto EXTENTS = PDECO->getWindowDecorationExtents();
|
||||||
|
|
||||||
wlr_box dmg = {PWINDOW->m_vRealPosition.vec().x - EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y - EXTENTS.topLeft.y,
|
wlr_box dmg = {PWINDOW->m_vRealPosition.vec().x - EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y - EXTENTS.topLeft.y,
|
||||||
PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x, PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y};
|
PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x,
|
||||||
|
PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y};
|
||||||
|
|
||||||
if (!*PSHADOWIGNOREWINDOW) {
|
if (!*PSHADOWIGNOREWINDOW) {
|
||||||
// easy, damage the entire box
|
// easy, damage the entire box
|
||||||
@ -206,7 +211,8 @@ void CAnimationManager::tick() {
|
|||||||
pixman_region32_t rg;
|
pixman_region32_t rg;
|
||||||
pixman_region32_init_rect(&rg, dmg.x, dmg.y, dmg.width, dmg.height);
|
pixman_region32_init_rect(&rg, dmg.x, dmg.y, dmg.width, dmg.height);
|
||||||
pixman_region32_t wb;
|
pixman_region32_t wb;
|
||||||
pixman_region32_init_rect(&wb, PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y);
|
pixman_region32_init_rect(&wb, PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x,
|
||||||
|
PWINDOW->m_vRealSize.vec().y);
|
||||||
pixman_region32_subtract(&rg, &rg, &wb);
|
pixman_region32_subtract(&rg, &rg, &wb);
|
||||||
g_pHyprRenderer->damageRegion(&rg);
|
g_pHyprRenderer->damageRegion(&rg);
|
||||||
pixman_region32_fini(&rg);
|
pixman_region32_fini(&rg);
|
||||||
@ -302,10 +308,14 @@ void CAnimationManager::animationSlide(CWindow* pWindow, std::string force, bool
|
|||||||
Vector2D posOffset;
|
Vector2D posOffset;
|
||||||
|
|
||||||
if (force != "") {
|
if (force != "") {
|
||||||
if (force == "bottom") posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y);
|
if (force == "bottom")
|
||||||
else if (force == "left") posOffset = GOALPOS - Vector2D(GOALSIZE.x, 0);
|
posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y);
|
||||||
else if (force == "right") posOffset = GOALPOS + Vector2D(GOALSIZE.x, 0);
|
else if (force == "left")
|
||||||
else posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y - GOALSIZE.y);
|
posOffset = GOALPOS - Vector2D(GOALSIZE.x, 0);
|
||||||
|
else if (force == "right")
|
||||||
|
posOffset = GOALPOS + Vector2D(GOALSIZE.x, 0);
|
||||||
|
else
|
||||||
|
posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y - GOALSIZE.y);
|
||||||
|
|
||||||
if (!close)
|
if (!close)
|
||||||
pWindow->m_vRealPosition.setValue(posOffset);
|
pWindow->m_vRealPosition.setValue(posOffset);
|
||||||
@ -426,9 +436,7 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
|
|||||||
try {
|
try {
|
||||||
auto percstr = style.substr(style.find_last_of(' '));
|
auto percstr = style.substr(style.find_last_of(' '));
|
||||||
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) { return "invalid minperc"; }
|
||||||
return "invalid minperc";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
class CAnimationManager {
|
class CAnimationManager {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CAnimationManager();
|
CAnimationManager();
|
||||||
|
|
||||||
void tick();
|
void tick();
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
CEventManager::CEventManager() {
|
CEventManager::CEventManager() {}
|
||||||
}
|
|
||||||
|
|
||||||
int fdHandleWrite(int fd, uint32_t mask, void* data) {
|
int fdHandleWrite(int fd, uint32_t mask, void* data) {
|
||||||
if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP) {
|
if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP) {
|
||||||
@ -70,7 +69,8 @@ void CEventManager::startThread() {
|
|||||||
Debug::log(LOG, "Socket 2 accepted a new client at FD %d", ACCEPTEDCONNECTION);
|
Debug::log(LOG, "Socket 2 accepted a new client at FD %d", ACCEPTEDCONNECTION);
|
||||||
|
|
||||||
// add to event loop so we can close it when we need to
|
// add to event loop so we can close it when we need to
|
||||||
m_dAcceptedSocketFDs.push_back({ACCEPTEDCONNECTION, wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, ACCEPTEDCONNECTION, WL_EVENT_READABLE, fdHandleWrite, &m_dAcceptedSocketFDs)});
|
m_dAcceptedSocketFDs.push_back(
|
||||||
|
{ACCEPTEDCONNECTION, wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, ACCEPTEDCONNECTION, WL_EVENT_READABLE, fdHandleWrite, &m_dAcceptedSocketFDs)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,11 +102,14 @@ void CEventManager::postEvent(const SHyprIPCEvent event, bool force) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::thread([&](const SHyprIPCEvent ev) {
|
std::thread(
|
||||||
|
[&](const SHyprIPCEvent ev) {
|
||||||
eventQueueMutex.lock();
|
eventQueueMutex.lock();
|
||||||
m_dQueuedEvents.push_back(ev);
|
m_dQueuedEvents.push_back(ev);
|
||||||
eventQueueMutex.unlock();
|
eventQueueMutex.unlock();
|
||||||
|
|
||||||
flushEvents();
|
flushEvents();
|
||||||
}, event).detach();
|
},
|
||||||
|
event)
|
||||||
|
.detach();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ public:
|
|||||||
std::thread m_tThread;
|
std::thread m_tThread;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void flushEvents();
|
void flushEvents();
|
||||||
|
|
||||||
std::mutex eventQueueMutex;
|
std::mutex eventQueueMutex;
|
||||||
|
@ -67,8 +67,7 @@ void CKeybindManager::removeKeybind(uint32_t mod, const std::string& key) {
|
|||||||
if (it == m_lKeybinds.end())
|
if (it == m_lKeybinds.end())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else if (it->modmask == mod && it->key == key) {
|
||||||
else if (it->modmask == mod && it->key == key) {
|
|
||||||
it = m_lKeybinds.erase(it);
|
it = m_lKeybinds.erase(it);
|
||||||
|
|
||||||
if (it == m_lKeybinds.end())
|
if (it == m_lKeybinds.end())
|
||||||
@ -116,21 +115,20 @@ void CKeybindManager::updateXKBTranslationState() {
|
|||||||
const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
|
const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
|
||||||
const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
|
const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
|
||||||
|
|
||||||
xkb_rule_names rules = {
|
xkb_rule_names rules = {.rules = RULES.c_str(), .model = MODEL.c_str(), .layout = LAYOUT.c_str(), .variant = VARIANT.c_str(), .options = OPTIONS.c_str()};
|
||||||
.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);
|
const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
|
|
||||||
auto PKEYMAP = FILEPATH == "" ? xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS) : xkb_keymap_new_from_file(PCONTEXT, fopen(FILEPATH.c_str(), "r"), XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
auto PKEYMAP = FILEPATH == "" ? xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS) :
|
||||||
|
xkb_keymap_new_from_file(PCONTEXT, fopen(FILEPATH.c_str(), "r"), XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
|
||||||
if (!PKEYMAP) {
|
if (!PKEYMAP) {
|
||||||
g_pHyprError->queueCreate("[Runtime Error] Invalid keyboard layout passed. ( rules: " + RULES + ", model: " + MODEL + ", variant: " + VARIANT + ", options: " + OPTIONS + ", layout: " + LAYOUT + " )", CColor(255, 50, 50, 255));
|
g_pHyprError->queueCreate("[Runtime Error] Invalid keyboard layout passed. ( rules: " + RULES + ", model: " + MODEL + ", variant: " + VARIANT + ", options: " + OPTIONS +
|
||||||
|
", layout: " + LAYOUT + " )",
|
||||||
|
CColor(255, 50, 50, 255));
|
||||||
|
|
||||||
Debug::log(ERR, "[XKBTranslationState] Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model, rules.options);
|
Debug::log(ERR, "[XKBTranslationState] Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant,
|
||||||
|
rules.rules, rules.model, rules.options);
|
||||||
memset(&rules, 0, sizeof(rules));
|
memset(&rules, 0, sizeof(rules));
|
||||||
|
|
||||||
PKEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
PKEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
@ -316,7 +314,8 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string&
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& k : m_lKeybinds) {
|
for (auto& k : m_lKeybinds) {
|
||||||
if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap || (!pressed && !k.release && k.handler != "pass" && k.handler != "mouse") || k.shadowed)
|
if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap ||
|
||||||
|
(!pressed && !k.release && k.handler != "pass" && k.handler != "mouse") || k.shadowed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!key.empty()) {
|
if (!key.empty()) {
|
||||||
@ -931,7 +930,8 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||||||
// and restore it
|
// and restore it
|
||||||
if (PWINDOW->m_bIsFloating) {
|
if (PWINDOW->m_bIsFloating) {
|
||||||
PWINDOW->m_vRealSize.setValueAndWarp(PSAVEDSIZE);
|
PWINDOW->m_vRealSize.setValueAndWarp(PSAVEDSIZE);
|
||||||
PWINDOW->m_vRealPosition.setValueAndWarp(PSAVEDPOS - g_pCompositor->getMonitorFromID(OLDWORKSPACE->m_iMonitorID)->vecPosition + g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID)->vecPosition);
|
PWINDOW->m_vRealPosition.setValueAndWarp(PSAVEDPOS - g_pCompositor->getMonitorFromID(OLDWORKSPACE->m_iMonitorID)->vecPosition +
|
||||||
|
g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID)->vecPosition);
|
||||||
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition.vec();
|
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition.vec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1045,7 +1045,6 @@ void CKeybindManager::moveFocusTo(std::string args) {
|
|||||||
g_pInputManager->unconstrainMouse();
|
g_pInputManager->unconstrainMouse();
|
||||||
|
|
||||||
auto switchToWindow = [&](CWindow* PWINDOWTOCHANGETO) {
|
auto switchToWindow = [&](CWindow* PWINDOWTOCHANGETO) {
|
||||||
|
|
||||||
if (PLASTWINDOW->m_iWorkspaceID == PWINDOWTOCHANGETO->m_iWorkspaceID && PLASTWINDOW->m_bIsFullscreen) {
|
if (PLASTWINDOW->m_iWorkspaceID == PWINDOWTOCHANGETO->m_iWorkspaceID && PLASTWINDOW->m_bIsFullscreen) {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PLASTWINDOW->m_iWorkspaceID);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PLASTWINDOW->m_iWorkspaceID);
|
||||||
const auto FSMODE = PWORKSPACE->m_efFullscreenMode;
|
const auto FSMODE = PWORKSPACE->m_efFullscreenMode;
|
||||||
@ -1202,15 +1201,18 @@ void CKeybindManager::moveCursorToCorner(std::string arg) {
|
|||||||
switch (CORNER) {
|
switch (CORNER) {
|
||||||
case 0:
|
case 0:
|
||||||
// bottom left
|
// bottom left
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y + PWINDOW->m_vRealSize.vec().y);
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PWINDOW->m_vRealPosition.vec().x,
|
||||||
|
PWINDOW->m_vRealPosition.vec().y + PWINDOW->m_vRealSize.vec().y);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// bottom right
|
// bottom right
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PWINDOW->m_vRealPosition.vec().x + PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealPosition.vec().y + PWINDOW->m_vRealSize.vec().y);
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PWINDOW->m_vRealPosition.vec().x + PWINDOW->m_vRealSize.vec().x,
|
||||||
|
PWINDOW->m_vRealPosition.vec().y + PWINDOW->m_vRealSize.vec().y);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// top right
|
// top right
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PWINDOW->m_vRealPosition.vec().x + PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealPosition.vec().y);
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PWINDOW->m_vRealPosition.vec().x + PWINDOW->m_vRealSize.vec().x,
|
||||||
|
PWINDOW->m_vRealPosition.vec().y);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// top left
|
// top left
|
||||||
@ -1607,7 +1609,6 @@ void CKeybindManager::pass(std::string regexp) {
|
|||||||
wlr_seat_pointer_enter(g_pCompositor->m_sSeat.seat, g_pXWaylandManager->getWindowSurface(PWINDOW), 1, 1);
|
wlr_seat_pointer_enter(g_pCompositor->m_sSeat.seat, g_pXWaylandManager->getWindowSurface(PWINDOW), 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wlr_keyboard_modifiers kbmods = {g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0};
|
wlr_keyboard_modifiers kbmods = {g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0};
|
||||||
wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &kbmods);
|
wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &kbmods);
|
||||||
|
|
||||||
@ -1708,7 +1709,10 @@ void CKeybindManager::swapnext(std::string arg) {
|
|||||||
|
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
||||||
|
|
||||||
const auto PLASTCYCLED = g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow->m_pLastCycledWindow) && g_pCompositor->m_pLastWindow->m_pLastCycledWindow->m_iWorkspaceID == PLASTWINDOW->m_iWorkspaceID ? g_pCompositor->m_pLastWindow->m_pLastCycledWindow : nullptr;
|
const auto PLASTCYCLED = g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow->m_pLastCycledWindow) &&
|
||||||
|
g_pCompositor->m_pLastWindow->m_pLastCycledWindow->m_iWorkspaceID == PLASTWINDOW->m_iWorkspaceID ?
|
||||||
|
g_pCompositor->m_pLastWindow->m_pLastCycledWindow :
|
||||||
|
nullptr;
|
||||||
|
|
||||||
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
|
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
|
||||||
toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTCYCLED ? PLASTCYCLED : PLASTWINDOW, true);
|
toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTCYCLED ? PLASTCYCLED : PLASTWINDOW, true);
|
||||||
|
@ -25,7 +25,8 @@ struct SKeybind {
|
|||||||
bool shadowed = false;
|
bool shadowed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eFocusWindowMode {
|
enum eFocusWindowMode
|
||||||
|
{
|
||||||
MODE_CLASS_REGEX = 0,
|
MODE_CLASS_REGEX = 0,
|
||||||
MODE_TITLE_REGEX,
|
MODE_TITLE_REGEX,
|
||||||
MODE_ADDRESS,
|
MODE_ADDRESS,
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
IHyprLayout* CLayoutManager::getCurrentLayout() {
|
IHyprLayout* CLayoutManager::getCurrentLayout() {
|
||||||
switch (m_iCurrentLayoutID) {
|
switch (m_iCurrentLayoutID) {
|
||||||
case DWINDLE:
|
case DWINDLE: return &m_cDwindleLayout;
|
||||||
return &m_cDwindleLayout;
|
case MASTER: return &m_cMasterLayout;
|
||||||
case MASTER:
|
|
||||||
return &m_cMasterLayout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback
|
// fallback
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
class CLayoutManager {
|
class CLayoutManager {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
IHyprLayout* getCurrentLayout();
|
IHyprLayout* getCurrentLayout();
|
||||||
|
|
||||||
void switchToLayout(std::string);
|
void switchToLayout(std::string);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum HYPRLAYOUTS {
|
enum HYPRLAYOUTS
|
||||||
|
{
|
||||||
DWINDLE = 0,
|
DWINDLE = 0,
|
||||||
MASTER
|
MASTER
|
||||||
};
|
};
|
||||||
|
@ -22,9 +22,7 @@ CHyprXWaylandManager::CHyprXWaylandManager() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CHyprXWaylandManager::~CHyprXWaylandManager() {
|
CHyprXWaylandManager::~CHyprXWaylandManager() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_surface* CHyprXWaylandManager::getWindowSurface(CWindow* pWindow) {
|
wlr_surface* CHyprXWaylandManager::getWindowSurface(CWindow* pWindow) {
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
@ -48,7 +46,6 @@ void CHyprXWaylandManager::activateSurface(wlr_surface* pSurface, bool activate)
|
|||||||
if (activate)
|
if (activate)
|
||||||
wlr_xwayland_surface_restack(wlr_xwayland_surface_from_wlr_surface(pSurface), NULL, XCB_STACK_MODE_ABOVE);
|
wlr_xwayland_surface_restack(wlr_xwayland_surface_from_wlr_surface(pSurface), NULL, XCB_STACK_MODE_ABOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
|
void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
|
||||||
@ -60,8 +57,7 @@ void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wlr_xwayland_surface_activate(pWindow->m_uSurface.xwayland, activate);
|
wlr_xwayland_surface_activate(pWindow->m_uSurface.xwayland, activate);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
wlr_xdg_toplevel_set_activated(pWindow->m_uSurface.xdg->toplevel, activate);
|
wlr_xdg_toplevel_set_activated(pWindow->m_uSurface.xdg->toplevel, activate);
|
||||||
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
@ -106,9 +102,7 @@ std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) {
|
|||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) { Debug::log(ERR, "Error in getTitle (probably null title)"); }
|
||||||
Debug::log(ERR, "Error in getTitle (probably null title)");
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -129,9 +123,7 @@ std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
|
|||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
} catch (std::logic_error& e) {
|
} catch (std::logic_error& e) { Debug::log(ERR, "Error in getAppIDClass: %s", e.what()); }
|
||||||
Debug::log(ERR, "Error in getAppIDClass: %s", e.what());
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -146,7 +138,8 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
|
|||||||
|
|
||||||
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size, bool force) {
|
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size, bool force) {
|
||||||
|
|
||||||
if (!force && ((pWindow->m_vReportedSize == size && pWindow->m_vRealPosition.vec() == pWindow->m_vReportedPosition) || (pWindow->m_vReportedSize == size && !pWindow->m_bIsX11)))
|
if (!force &&
|
||||||
|
((pWindow->m_vReportedSize == size && pWindow->m_vRealPosition.vec() == pWindow->m_vReportedPosition) || (pWindow->m_vReportedSize == size && !pWindow->m_bIsX11)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pWindow->m_vReportedPosition = pWindow->m_vRealPosition.vec();
|
pWindow->m_vReportedPosition = pWindow->m_vRealPosition.vec();
|
||||||
@ -173,13 +166,18 @@ wlr_surface* CHyprXWaylandManager::surfaceAt(CWindow* pWindow, const Vector2D& c
|
|||||||
bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
|
bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
for (size_t i = 0; i < pWindow->m_uSurface.xwayland->window_type_len; i++)
|
for (size_t i = 0; i < pWindow->m_uSurface.xwayland->window_type_len; i++)
|
||||||
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
|
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] ||
|
||||||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLBAR"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"] ||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
|
||||||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] ||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLBAR"] ||
|
||||||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] ||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"]) {
|
||||||
|
|
||||||
|
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] ||
|
||||||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"])
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"])
|
||||||
{
|
|
||||||
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"])
|
|
||||||
pWindow->m_bX11ShouldntFocus = true;
|
pWindow->m_bX11ShouldntFocus = true;
|
||||||
|
|
||||||
pWindow->m_bNoInitialFocus = true;
|
pWindow->m_bNoInitialFocus = true;
|
||||||
@ -192,9 +190,7 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
|
|||||||
if (winrole.contains("pop-up") || winrole.contains("task_dialog")) {
|
if (winrole.contains("pop-up") || winrole.contains("task_dialog")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) { Debug::log(ERR, "Error in shouldBeFloated, winrole threw %s", e.what()); }
|
||||||
Debug::log(ERR, "Error in shouldBeFloated, winrole threw %s", e.what());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow->m_uSurface.xwayland->modal) {
|
if (pWindow->m_uSurface.xwayland->modal) {
|
||||||
@ -212,7 +208,8 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
|
|||||||
} else {
|
} else {
|
||||||
const auto PSTATE = &pWindow->m_uSurface.xdg->toplevel->current;
|
const auto PSTATE = &pWindow->m_uSurface.xdg->toplevel->current;
|
||||||
|
|
||||||
if ((PSTATE->min_width != 0 && PSTATE->min_height != 0 && (PSTATE->min_width == PSTATE->max_width || PSTATE->min_height == PSTATE->max_height)) || pWindow->m_uSurface.xdg->toplevel->parent)
|
if ((PSTATE->min_width != 0 && PSTATE->min_height != 0 && (PSTATE->min_width == PSTATE->max_width || PSTATE->min_height == PSTATE->max_height)) ||
|
||||||
|
pWindow->m_uSurface.xdg->toplevel->parent)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,9 +230,12 @@ void CHyprXWaylandManager::checkBorders(CWindow* pWindow) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (size_t i = 0; i < pWindow->m_uSurface.xwayland->window_type_len; i++) {
|
for (size_t i = 0; i < pWindow->m_uSurface.xwayland->window_type_len; i++) {
|
||||||
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_NOTIFICATION"] ||
|
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] ||
|
||||||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] ||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_NOTIFICATION"] ||
|
||||||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] ||
|
||||||
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
|
||||||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) {
|
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) {
|
||||||
|
|
||||||
pWindow->m_bX11DoesntWantBorders = true;
|
pWindow->m_bX11DoesntWantBorders = true;
|
||||||
@ -263,11 +263,12 @@ Vector2D CHyprXWaylandManager::getMaxSizeForWindow(CWindow* pWindow) {
|
|||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!g_pCompositor->windowValidMapped(pWindow))
|
||||||
return Vector2D(99999, 99999);
|
return Vector2D(99999, 99999);
|
||||||
|
|
||||||
if ((pWindow->m_bIsX11 && !pWindow->m_uSurface.xwayland->size_hints) || (!pWindow->m_bIsX11 && !pWindow->m_uSurface.xdg->toplevel) || pWindow->m_sAdditionalConfigData.noMaxSize)
|
if ((pWindow->m_bIsX11 && !pWindow->m_uSurface.xwayland->size_hints) || (!pWindow->m_bIsX11 && !pWindow->m_uSurface.xdg->toplevel) ||
|
||||||
|
pWindow->m_sAdditionalConfigData.noMaxSize)
|
||||||
return Vector2D(99999, 99999);
|
return Vector2D(99999, 99999);
|
||||||
|
|
||||||
auto MAXSIZE = pWindow->m_bIsX11 ? Vector2D(pWindow->m_uSurface.xwayland->size_hints->max_width, pWindow->m_uSurface.xwayland->size_hints->max_height)
|
auto MAXSIZE = pWindow->m_bIsX11 ? Vector2D(pWindow->m_uSurface.xwayland->size_hints->max_width, pWindow->m_uSurface.xwayland->size_hints->max_height) :
|
||||||
: Vector2D(pWindow->m_uSurface.xdg->toplevel->current.max_width, pWindow->m_uSurface.xdg->toplevel->current.max_height);
|
Vector2D(pWindow->m_uSurface.xdg->toplevel->current.max_width, pWindow->m_uSurface.xdg->toplevel->current.max_height);
|
||||||
|
|
||||||
if (MAXSIZE.x < 5)
|
if (MAXSIZE.x < 5)
|
||||||
MAXSIZE.x = 99999;
|
MAXSIZE.x = 99999;
|
||||||
|
@ -17,8 +17,9 @@ void CInputManager::newIdleInhibitor(wlr_idle_inhibitor_v1* pInhibitor) {
|
|||||||
|
|
||||||
PINHIBIT->pWlrInhibitor = pInhibitor;
|
PINHIBIT->pWlrInhibitor = pInhibitor;
|
||||||
|
|
||||||
PINHIBIT->hyprListener_Destroy.initCallback(&pInhibitor->events.destroy, [](void* owner, void* data){
|
PINHIBIT->hyprListener_Destroy.initCallback(
|
||||||
|
&pInhibitor->events.destroy,
|
||||||
|
[](void* owner, void* data) {
|
||||||
const auto PINH = (SIdleInhibitor*)owner;
|
const auto PINH = (SIdleInhibitor*)owner;
|
||||||
|
|
||||||
g_pInputManager->m_lIdleInhibitors.remove(*PINH);
|
g_pInputManager->m_lIdleInhibitors.remove(*PINH);
|
||||||
@ -26,8 +27,8 @@ void CInputManager::newIdleInhibitor(wlr_idle_inhibitor_v1* pInhibitor) {
|
|||||||
Debug::log(LOG, "Destroyed an idleinhibitor");
|
Debug::log(LOG, "Destroyed an idleinhibitor");
|
||||||
|
|
||||||
g_pInputManager->recheckIdleInhibitorStatus();
|
g_pInputManager->recheckIdleInhibitorStatus();
|
||||||
|
},
|
||||||
}, PINHIBIT, "IdleInhibitor");
|
PINHIBIT, "IdleInhibitor");
|
||||||
|
|
||||||
PINHIBIT->pWindow = g_pCompositor->getWindowFromSurface(pInhibitor->surface);
|
PINHIBIT->pWindow = g_pCompositor->getWindowFromSurface(pInhibitor->surface);
|
||||||
|
|
||||||
|
@ -9,9 +9,11 @@ void CInputManager::onMouseMoved(wlr_pointer_motion_event* e) {
|
|||||||
const auto DELTA = *PNOACCEL == 1 ? Vector2D(e->unaccel_dx, e->unaccel_dy) : Vector2D(e->delta_x, e->delta_y);
|
const auto DELTA = *PNOACCEL == 1 ? Vector2D(e->unaccel_dx, e->unaccel_dy) : Vector2D(e->delta_x, e->delta_y);
|
||||||
|
|
||||||
if (*PSENSTORAW == 1)
|
if (*PSENSTORAW == 1)
|
||||||
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x * *PSENS, DELTA.y * *PSENS, e->unaccel_dx * *PSENS, e->unaccel_dy * *PSENS);
|
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x * *PSENS,
|
||||||
|
DELTA.y * *PSENS, e->unaccel_dx * *PSENS, e->unaccel_dy * *PSENS);
|
||||||
else
|
else
|
||||||
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x, DELTA.y, e->unaccel_dx, e->unaccel_dy);
|
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x, DELTA.y,
|
||||||
|
e->unaccel_dx, e->unaccel_dy);
|
||||||
|
|
||||||
wlr_cursor_move(g_pCompositor->m_sWLRCursor, &e->pointer->base, DELTA.x * *PSENS, DELTA.y * *PSENS);
|
wlr_cursor_move(g_pCompositor->m_sWLRCursor, &e->pointer->base, DELTA.x * *PSENS, DELTA.y * *PSENS);
|
||||||
|
|
||||||
@ -80,8 +82,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
} else {
|
} else {
|
||||||
// Native Wayland apps know how 2 constrain themselves.
|
// Native Wayland apps know how 2 constrain themselves.
|
||||||
// XWayland, we just have to accept them. Might cause issues, but thats XWayland for ya.
|
// XWayland, we just have to accept them. Might cause issues, but thats XWayland for ya.
|
||||||
const auto CONSTRAINTPOS = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->x, CONSTRAINTWINDOW->m_uSurface.xwayland->y) : CONSTRAINTWINDOW->m_vRealPosition.vec();
|
const auto CONSTRAINTPOS =
|
||||||
const auto CONSTRAINTSIZE = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->width, CONSTRAINTWINDOW->m_uSurface.xwayland->height) : CONSTRAINTWINDOW->m_vRealSize.vec();
|
CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->x, CONSTRAINTWINDOW->m_uSurface.xwayland->y) : CONSTRAINTWINDOW->m_vRealPosition.vec();
|
||||||
|
const auto CONSTRAINTSIZE = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->width, CONSTRAINTWINDOW->m_uSurface.xwayland->height) :
|
||||||
|
CONSTRAINTWINDOW->m_vRealSize.vec();
|
||||||
|
|
||||||
if (g_pCompositor->m_sSeat.mouse->currentConstraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED) {
|
if (g_pCompositor->m_sSeat.mouse->currentConstraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED) {
|
||||||
// we just snap the cursor to where it should be.
|
// we just snap the cursor to where it should be.
|
||||||
@ -152,7 +156,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
// only check floating because tiled cant be over fullscreen
|
// only check floating because tiled cant be over fullscreen
|
||||||
for (auto w = g_pCompositor->m_vWindows.rbegin(); w != g_pCompositor->m_vWindows.rend(); w++) {
|
for (auto w = g_pCompositor->m_vWindows.rbegin(); w != g_pCompositor->m_vWindows.rend(); w++) {
|
||||||
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
|
||||||
if ((((*w)->m_bIsFloating && (*w)->m_bIsMapped && ((*w)->m_bCreatedOverFullscreen || (*w)->m_bPinned)) || (g_pCompositor->isWorkspaceSpecial((*w)->m_iWorkspaceID) && PMONITOR->specialWorkspaceID)) && wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && g_pCompositor->isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden()) {
|
if ((((*w)->m_bIsFloating && (*w)->m_bIsMapped && ((*w)->m_bCreatedOverFullscreen || (*w)->m_bPinned)) ||
|
||||||
|
(g_pCompositor->isWorkspaceSpecial((*w)->m_iWorkspaceID) && PMONITOR->specialWorkspaceID)) &&
|
||||||
|
wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && g_pCompositor->isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden()) {
|
||||||
pFoundWindow = (*w).get();
|
pFoundWindow = (*w).get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -265,7 +271,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
|
|
||||||
if (pFoundWindow) {
|
if (pFoundWindow) {
|
||||||
if (*PFOLLOWMOUSE != 1 && !refocus) {
|
if (*PFOLLOWMOUSE != 1 && !refocus) {
|
||||||
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow && ((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
|
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow &&
|
||||||
|
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
|
||||||
// enter if change floating style
|
// enter if change floating style
|
||||||
if (*PFOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
if (*PFOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
||||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||||
@ -315,14 +322,9 @@ void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
|
|||||||
m_tmrLastCursorMovement.reset();
|
m_tmrLastCursorMovement.reset();
|
||||||
|
|
||||||
switch (m_ecbClickBehavior) {
|
switch (m_ecbClickBehavior) {
|
||||||
case CLICKMODE_DEFAULT:
|
case CLICKMODE_DEFAULT: processMouseDownNormal(e); break;
|
||||||
processMouseDownNormal(e);
|
case CLICKMODE_KILL: processMouseDownKill(e); break;
|
||||||
break;
|
default: break;
|
||||||
case CLICKMODE_KILL:
|
|
||||||
processMouseDownKill(e);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,8 +374,7 @@ void CInputManager::setClickMode(eClickBehaviorMode mode) {
|
|||||||
// set cursor
|
// set cursor
|
||||||
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "crosshair", g_pCompositor->m_sWLRCursor);
|
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "crosshair", g_pCompositor->m_sWLRCursor);
|
||||||
break;
|
break;
|
||||||
default:
|
default: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,8 +401,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
|
|||||||
g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);
|
g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WLR_BUTTON_RELEASED:
|
case WLR_BUTTON_RELEASED: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// notify app if we didnt handle it
|
// notify app if we didnt handle it
|
||||||
@ -424,10 +424,8 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
|
|||||||
kill(PWINDOW->getPID(), SIGKILL);
|
kill(PWINDOW->getPID(), SIGKILL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WLR_BUTTON_RELEASED:
|
case WLR_BUTTON_RELEASED: break;
|
||||||
break;
|
default: break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset click behavior mode
|
// reset click behavior mode
|
||||||
@ -444,8 +442,7 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
|
|||||||
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
|
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
|
||||||
|
|
||||||
if (passEvent) {
|
if (passEvent) {
|
||||||
wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, factor * e->delta,
|
wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, factor * e->delta, std::round(factor * e->delta_discrete), e->source);
|
||||||
std::round(factor * e->delta_discrete), e->source);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,12 +465,14 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
|||||||
PNEWKEYBOARD->hyprListener_keyboardKey.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.key, &Events::listener_keyboardKey, PNEWKEYBOARD, "Keyboard");
|
PNEWKEYBOARD->hyprListener_keyboardKey.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.key, &Events::listener_keyboardKey, PNEWKEYBOARD, "Keyboard");
|
||||||
PNEWKEYBOARD->hyprListener_keyboardDestroy.initCallback(&keyboard->events.destroy, &Events::listener_keyboardDestroy, PNEWKEYBOARD, "Keyboard");
|
PNEWKEYBOARD->hyprListener_keyboardDestroy.initCallback(&keyboard->events.destroy, &Events::listener_keyboardDestroy, PNEWKEYBOARD, "Keyboard");
|
||||||
|
|
||||||
PNEWKEYBOARD->hyprListener_keyboardKeymap.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.keymap, [&](void* owner, void* data) {
|
PNEWKEYBOARD->hyprListener_keyboardKeymap.initCallback(
|
||||||
|
&wlr_keyboard_from_input_device(keyboard)->events.keymap,
|
||||||
|
[&](void* owner, void* data) {
|
||||||
const auto PKEYBOARD = (SKeyboard*)owner;
|
const auto PKEYBOARD = (SKeyboard*)owner;
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," + getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent
|
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," + getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent
|
||||||
|
},
|
||||||
}, PNEWKEYBOARD, "Keyboard");
|
PNEWKEYBOARD, "Keyboard");
|
||||||
|
|
||||||
disableAllKeyboards(false);
|
disableAllKeyboards(false);
|
||||||
|
|
||||||
@ -503,12 +502,14 @@ void CInputManager::newVirtualKeyboard(wlr_input_device* keyboard) {
|
|||||||
PNEWKEYBOARD->hyprListener_keyboardMod.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.modifiers, &Events::listener_keyboardMod, PNEWKEYBOARD, "Keyboard");
|
PNEWKEYBOARD->hyprListener_keyboardMod.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.modifiers, &Events::listener_keyboardMod, PNEWKEYBOARD, "Keyboard");
|
||||||
PNEWKEYBOARD->hyprListener_keyboardKey.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.key, &Events::listener_keyboardKey, PNEWKEYBOARD, "Keyboard");
|
PNEWKEYBOARD->hyprListener_keyboardKey.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.key, &Events::listener_keyboardKey, PNEWKEYBOARD, "Keyboard");
|
||||||
PNEWKEYBOARD->hyprListener_keyboardDestroy.initCallback(&keyboard->events.destroy, &Events::listener_keyboardDestroy, PNEWKEYBOARD, "Keyboard");
|
PNEWKEYBOARD->hyprListener_keyboardDestroy.initCallback(&keyboard->events.destroy, &Events::listener_keyboardDestroy, PNEWKEYBOARD, "Keyboard");
|
||||||
PNEWKEYBOARD->hyprListener_keyboardKeymap.initCallback(&wlr_keyboard_from_input_device(keyboard)->events.keymap, [&](void* owner, void* data) {
|
PNEWKEYBOARD->hyprListener_keyboardKeymap.initCallback(
|
||||||
|
&wlr_keyboard_from_input_device(keyboard)->events.keymap,
|
||||||
|
[&](void* owner, void* data) {
|
||||||
const auto PKEYBOARD = (SKeyboard*)owner;
|
const auto PKEYBOARD = (SKeyboard*)owner;
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," + getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent
|
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," + getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent
|
||||||
|
},
|
||||||
}, PNEWKEYBOARD, "Keyboard");
|
PNEWKEYBOARD, "Keyboard");
|
||||||
|
|
||||||
disableAllKeyboards(true);
|
disableAllKeyboards(true);
|
||||||
|
|
||||||
@ -555,7 +556,9 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
|
|||||||
const auto OPTIONS = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "kb_options") : g_pConfigManager->getString("input:kb_options");
|
const auto OPTIONS = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "kb_options") : g_pConfigManager->getString("input:kb_options");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" && RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout && VARIANT == pKeyboard->currentRules.variant && OPTIONS == pKeyboard->currentRules.options && FILEPATH == pKeyboard->xkbFilePath) {
|
if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" &&
|
||||||
|
RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout &&
|
||||||
|
VARIANT == pKeyboard->currentRules.variant && OPTIONS == pKeyboard->currentRules.options && FILEPATH == pKeyboard->xkbFilePath) {
|
||||||
Debug::log(LOG, "Not applying config to keyboard, it did not change.");
|
Debug::log(LOG, "Not applying config to keyboard, it did not change.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -571,12 +574,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
|
|||||||
pKeyboard->numlockOn = NUMLOCKON;
|
pKeyboard->numlockOn = NUMLOCKON;
|
||||||
pKeyboard->xkbFilePath = FILEPATH.c_str();
|
pKeyboard->xkbFilePath = FILEPATH.c_str();
|
||||||
|
|
||||||
xkb_rule_names rules = {
|
xkb_rule_names rules = {.rules = RULES.c_str(), .model = MODEL.c_str(), .layout = LAYOUT.c_str(), .variant = VARIANT.c_str(), .options = OPTIONS.c_str()};
|
||||||
.rules = RULES.c_str(),
|
|
||||||
.model = MODEL.c_str(),
|
|
||||||
.layout = LAYOUT.c_str(),
|
|
||||||
.variant = VARIANT.c_str(),
|
|
||||||
.options = OPTIONS.c_str()};
|
|
||||||
|
|
||||||
pKeyboard->currentRules.rules = RULES;
|
pKeyboard->currentRules.rules = RULES;
|
||||||
pKeyboard->currentRules.model = MODEL;
|
pKeyboard->currentRules.model = MODEL;
|
||||||
@ -591,7 +589,8 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Attempting to create a keymap for layout %s with variant %s (rules: %s, model: %s, options: %s)", rules.layout, rules.variant, rules.rules, rules.model, rules.options);
|
Debug::log(LOG, "Attempting to create a keymap for layout %s with variant %s (rules: %s, model: %s, options: %s)", rules.layout, rules.variant, rules.rules, rules.model,
|
||||||
|
rules.options);
|
||||||
|
|
||||||
xkb_keymap* KEYMAP = NULL;
|
xkb_keymap* KEYMAP = NULL;
|
||||||
|
|
||||||
@ -610,9 +609,11 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!KEYMAP) {
|
if (!KEYMAP) {
|
||||||
g_pConfigManager->addParseError("Invalid keyboard layout passed. ( rules: " + RULES + ", model: " + MODEL + ", variant: " + VARIANT + ", options: " + OPTIONS + ", layout: " + LAYOUT + " )");
|
g_pConfigManager->addParseError("Invalid keyboard layout passed. ( rules: " + RULES + ", model: " + MODEL + ", variant: " + VARIANT + ", options: " + OPTIONS +
|
||||||
|
", layout: " + LAYOUT + " )");
|
||||||
|
|
||||||
Debug::log(ERR, "Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model, rules.options);
|
Debug::log(ERR, "Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model,
|
||||||
|
rules.options);
|
||||||
memset(&rules, 0, sizeof(rules));
|
memset(&rules, 0, sizeof(rules));
|
||||||
|
|
||||||
pKeyboard->currentRules.rules = "";
|
pKeyboard->currentRules.rules = "";
|
||||||
@ -663,7 +664,9 @@ void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
|
|||||||
if (wlr_input_device_is_libinput(mouse)) {
|
if (wlr_input_device_is_libinput(mouse)) {
|
||||||
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(mouse);
|
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(mouse);
|
||||||
|
|
||||||
Debug::log(LOG, "New mouse has libinput sens %.2f (%.2f) with accel profile %i (%i)", libinput_device_config_accel_get_speed(LIBINPUTDEV), libinput_device_config_accel_get_default_speed(LIBINPUTDEV), libinput_device_config_accel_get_profile(LIBINPUTDEV), libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
|
Debug::log(LOG, "New mouse has libinput sens %.2f (%.2f) with accel profile %i (%i)", libinput_device_config_accel_get_speed(LIBINPUTDEV),
|
||||||
|
libinput_device_config_accel_get_default_speed(LIBINPUTDEV), libinput_device_config_accel_get_profile(LIBINPUTDEV),
|
||||||
|
libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
|
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
|
||||||
@ -703,7 +706,8 @@ void CInputManager::setPointerConfigs() {
|
|||||||
if (wlr_input_device_is_libinput(m.mouse)) {
|
if (wlr_input_device_is_libinput(m.mouse)) {
|
||||||
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.mouse);
|
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.mouse);
|
||||||
|
|
||||||
if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "clickfinger_behavior") : g_pConfigManager->getInt("input:touchpad:clickfinger_behavior")) == 0) // toggle software buttons or clickfinger
|
if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "clickfinger_behavior") : g_pConfigManager->getInt("input:touchpad:clickfinger_behavior")) ==
|
||||||
|
0) // toggle software buttons or clickfinger
|
||||||
libinput_device_config_click_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
libinput_device_config_click_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||||
else
|
else
|
||||||
libinput_device_config_click_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
libinput_device_config_click_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
@ -747,18 +751,23 @@ void CInputManager::setPointerConfigs() {
|
|||||||
if (libinput_device_config_scroll_has_natural_scroll(LIBINPUTDEV)) {
|
if (libinput_device_config_scroll_has_natural_scroll(LIBINPUTDEV)) {
|
||||||
double w = 0, h = 0;
|
double w = 0, h = 0;
|
||||||
|
|
||||||
if (libinput_device_has_capability(LIBINPUTDEV, LIBINPUT_DEVICE_CAP_POINTER) && libinput_device_get_size(LIBINPUTDEV, &w, &h) == 0) // pointer with size is a touchpad
|
if (libinput_device_has_capability(LIBINPUTDEV, LIBINPUT_DEVICE_CAP_POINTER) &&
|
||||||
libinput_device_config_scroll_set_natural_scroll_enabled(LIBINPUTDEV, (HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "natural_scroll") : g_pConfigManager->getInt("input:touchpad:natural_scroll")));
|
libinput_device_get_size(LIBINPUTDEV, &w, &h) == 0) // pointer with size is a touchpad
|
||||||
|
libinput_device_config_scroll_set_natural_scroll_enabled(
|
||||||
|
LIBINPUTDEV, (HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "natural_scroll") : g_pConfigManager->getInt("input:touchpad:natural_scroll")));
|
||||||
else
|
else
|
||||||
libinput_device_config_scroll_set_natural_scroll_enabled(LIBINPUTDEV, (HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "natural_scroll") : g_pConfigManager->getInt("input:natural_scroll")));
|
libinput_device_config_scroll_set_natural_scroll_enabled(
|
||||||
|
LIBINPUTDEV, (HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "natural_scroll") : g_pConfigManager->getInt("input:natural_scroll")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libinput_device_config_dwt_is_available(LIBINPUTDEV)) {
|
if (libinput_device_config_dwt_is_available(LIBINPUTDEV)) {
|
||||||
const auto DWT = static_cast<enum libinput_config_dwt_state>((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "disable_while_typing") : g_pConfigManager->getInt("input:touchpad:disable_while_typing")) != 0);
|
const auto DWT = static_cast<enum libinput_config_dwt_state>(
|
||||||
|
(HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "disable_while_typing") : g_pConfigManager->getInt("input:touchpad:disable_while_typing")) != 0);
|
||||||
libinput_device_config_dwt_set_enabled(LIBINPUTDEV, DWT);
|
libinput_device_config_dwt_set_enabled(LIBINPUTDEV, DWT);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto LIBINPUTSENS = std::clamp((HASCONFIG ? g_pConfigManager->getDeviceFloat(devname, "sensitivity") : g_pConfigManager->getFloat("input:sensitivity")), -1.f, 1.f);
|
const auto LIBINPUTSENS =
|
||||||
|
std::clamp((HASCONFIG ? g_pConfigManager->getDeviceFloat(devname, "sensitivity") : g_pConfigManager->getFloat("input:sensitivity")), -1.f, 1.f);
|
||||||
libinput_device_config_accel_set_speed(LIBINPUTDEV, LIBINPUTSENS);
|
libinput_device_config_accel_set_speed(LIBINPUTDEV, LIBINPUTSENS);
|
||||||
|
|
||||||
const auto ACCELPROFILE = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "accel_profile") : g_pConfigManager->getString("input:accel_profile");
|
const auto ACCELPROFILE = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "accel_profile") : g_pConfigManager->getString("input:accel_profile");
|
||||||
@ -815,7 +824,6 @@ void CInputManager::destroyMouse(wlr_input_device* mouse) {
|
|||||||
unconstrainMouse();
|
unconstrainMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CInputManager::updateKeyboardsLeds(wlr_input_device* pKeyboard) {
|
void CInputManager::updateKeyboardsLeds(wlr_input_device* pKeyboard) {
|
||||||
auto keyboard = wlr_keyboard_from_input_device(pKeyboard);
|
auto keyboard = wlr_keyboard_from_input_device(pKeyboard);
|
||||||
|
|
||||||
@ -825,8 +833,7 @@ void CInputManager::updateKeyboardsLeds(wlr_input_device* pKeyboard) {
|
|||||||
|
|
||||||
uint32_t leds = 0;
|
uint32_t leds = 0;
|
||||||
for (uint32_t i = 0; i < WLR_LED_COUNT; ++i) {
|
for (uint32_t i = 0; i < WLR_LED_COUNT; ++i) {
|
||||||
if (xkb_state_led_index_is_active(keyboard->xkb_state,
|
if (xkb_state_led_index_is_active(keyboard->xkb_state, keyboard->led_indexes[i])) {
|
||||||
keyboard->led_indexes[i])) {
|
|
||||||
leds |= (1 << i);
|
leds |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -839,7 +846,6 @@ void CInputManager::updateKeyboardsLeds(wlr_input_device* pKeyboard) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboard) {
|
void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboard) {
|
||||||
bool passEvent = g_pKeybindManager->onKeyEvent(e, pKeyboard);
|
bool passEvent = g_pKeybindManager->onKeyEvent(e, pKeyboard);
|
||||||
|
|
||||||
@ -889,7 +895,9 @@ void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CInputManager::shouldIgnoreVirtualKeyboard(SKeyboard* pKeyboard) {
|
bool CInputManager::shouldIgnoreVirtualKeyboard(SKeyboard* pKeyboard) {
|
||||||
return !pKeyboard || (m_sIMERelay.m_pKeyboardGrab && wl_resource_get_client(m_sIMERelay.m_pKeyboardGrab->pWlrKbGrab->resource) == wl_resource_get_client(wlr_input_device_get_virtual_keyboard(pKeyboard->keyboard)->resource));
|
return !pKeyboard ||
|
||||||
|
(m_sIMERelay.m_pKeyboardGrab &&
|
||||||
|
wl_resource_get_client(m_sIMERelay.m_pKeyboardGrab->pWlrKbGrab->resource) == wl_resource_get_client(wlr_input_device_get_virtual_keyboard(pKeyboard->keyboard)->resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::refocus() {
|
void CInputManager::refocus() {
|
||||||
@ -901,16 +909,14 @@ void CInputManager::updateDragIcon() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
switch (m_sDrag.dragIcon->drag->grab_type) {
|
switch (m_sDrag.dragIcon->drag->grab_type) {
|
||||||
case WLR_DRAG_GRAB_KEYBOARD:
|
case WLR_DRAG_GRAB_KEYBOARD: break;
|
||||||
break;
|
|
||||||
case WLR_DRAG_GRAB_KEYBOARD_POINTER: {
|
case WLR_DRAG_GRAB_KEYBOARD_POINTER: {
|
||||||
wlr_box box = {m_sDrag.pos.x - 2, m_sDrag.pos.y - 2, m_sDrag.dragIcon->surface->current.width + 4, m_sDrag.dragIcon->surface->current.height + 4};
|
wlr_box box = {m_sDrag.pos.x - 2, m_sDrag.pos.y - 2, m_sDrag.dragIcon->surface->current.width + 4, m_sDrag.dragIcon->surface->current.height + 4};
|
||||||
g_pHyprRenderer->damageBox(&box);
|
g_pHyprRenderer->damageBox(&box);
|
||||||
m_sDrag.pos = getMouseCoordsInternal();
|
m_sDrag.pos = getMouseCoordsInternal();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -929,7 +935,8 @@ void CInputManager::recheckConstraint(SMouse* pMouse) {
|
|||||||
const auto PWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse);
|
const auto PWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse);
|
||||||
const auto PWINDOWNAME = PWINDOW ? PWINDOW->m_szTitle : "";
|
const auto PWINDOWNAME = PWINDOW ? PWINDOW->m_szTitle : "";
|
||||||
|
|
||||||
Debug::log(LOG, "Constraint rechecked: %i, %i to %i, %i for %x (window name: %s)", PREGION->extents.x1, PREGION->extents.y1, PREGION->extents.x2, PREGION->extents.y2, pMouse->currentConstraint->surface, PWINDOWNAME.c_str());
|
Debug::log(LOG, "Constraint rechecked: %i, %i to %i, %i for %x (window name: %s)", PREGION->extents.x1, PREGION->extents.y1, PREGION->extents.x2, PREGION->extents.y2,
|
||||||
|
pMouse->currentConstraint->surface, PWINDOWNAME.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* constraint) {
|
void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* constraint) {
|
||||||
@ -949,13 +956,13 @@ void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* co
|
|||||||
if (constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT) {
|
if (constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT) {
|
||||||
if (PWINDOW) {
|
if (PWINDOW) {
|
||||||
if (PWINDOW->m_bIsX11) {
|
if (PWINDOW->m_bIsX11) {
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, constraint->current.cursor_hint.x + PWINDOW->m_uSurface.xwayland->x,
|
||||||
constraint->current.cursor_hint.x + PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y + PWINDOW->m_vRealPosition.vec().y);
|
PWINDOW->m_uSurface.xwayland->y + PWINDOW->m_vRealPosition.vec().y);
|
||||||
|
|
||||||
wlr_seat_pointer_warp(constraint->seat, constraint->current.cursor_hint.x, constraint->current.cursor_hint.y);
|
wlr_seat_pointer_warp(constraint->seat, constraint->current.cursor_hint.x, constraint->current.cursor_hint.y);
|
||||||
} else {
|
} else {
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, constraint->current.cursor_hint.x + PWINDOW->m_vRealPosition.vec().x,
|
||||||
constraint->current.cursor_hint.x + PWINDOW->m_vRealPosition.vec().x, constraint->current.cursor_hint.y + PWINDOW->m_vRealPosition.vec().y);
|
constraint->current.cursor_hint.y + PWINDOW->m_vRealPosition.vec().y);
|
||||||
|
|
||||||
wlr_seat_pointer_warp(constraint->seat, constraint->current.cursor_hint.x, constraint->current.cursor_hint.y);
|
wlr_seat_pointer_warp(constraint->seat, constraint->current.cursor_hint.x, constraint->current.cursor_hint.y);
|
||||||
}
|
}
|
||||||
@ -1096,47 +1103,28 @@ void CInputManager::newTouchDevice(wlr_input_device* pDevice) {
|
|||||||
|
|
||||||
Debug::log(LOG, "New touch device added at %x", PNEWDEV);
|
Debug::log(LOG, "New touch device added at %x", PNEWDEV);
|
||||||
|
|
||||||
PNEWDEV->hyprListener_destroy.initCallback(&pDevice->events.destroy, [&](void* owner, void* data) {
|
PNEWDEV->hyprListener_destroy.initCallback(
|
||||||
destroyTouchDevice((STouchDevice*)data);
|
&pDevice->events.destroy, [&](void* owner, void* data) { destroyTouchDevice((STouchDevice*)data); }, PNEWDEV, "TouchDevice");
|
||||||
}, PNEWDEV, "TouchDevice");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setTouchDeviceConfigs() {
|
void CInputManager::setTouchDeviceConfigs() {
|
||||||
// The third row is always 0 0 1 and is not expected by `libinput_device_config_calibration_set_matrix`
|
// The third row is always 0 0 1 and is not expected by `libinput_device_config_calibration_set_matrix`
|
||||||
static const float MATRICES[8][6] = {
|
static const float MATRICES[8][6] = {{// normal
|
||||||
{ // normal
|
1, 0, 0, 0, 1, 0},
|
||||||
1, 0, 0,
|
|
||||||
0, 1, 0
|
|
||||||
},
|
|
||||||
{// rotation 90°
|
{// rotation 90°
|
||||||
0, -1, 1,
|
0, -1, 1, 1, 0, 0},
|
||||||
1, 0, 0
|
|
||||||
},
|
|
||||||
{// rotation 180°
|
{// rotation 180°
|
||||||
-1, 0, 1,
|
-1, 0, 1, 0, -1, 1},
|
||||||
0, -1, 1
|
|
||||||
},
|
|
||||||
{// rotation 270°
|
{// rotation 270°
|
||||||
0, 1, 0,
|
0, 1, 0, -1, 0, 1},
|
||||||
-1, 0, 1
|
|
||||||
},
|
|
||||||
{// flipped
|
{// flipped
|
||||||
-1, 0, 1,
|
-1, 0, 1, 0, 1, 0},
|
||||||
0, 1, 0
|
|
||||||
},
|
|
||||||
{// flipped + rotation 90°
|
{// flipped + rotation 90°
|
||||||
0, 1, 0,
|
0, 1, 0, 1, 0, 0},
|
||||||
1, 0, 0
|
|
||||||
},
|
|
||||||
{// flipped + rotation 180°
|
{// flipped + rotation 180°
|
||||||
1, 0, 0,
|
1, 0, 0, 0, -1, 1},
|
||||||
0, -1, 1
|
|
||||||
},
|
|
||||||
{// flipped + rotation 270°
|
{// flipped + rotation 270°
|
||||||
0, -1, 1,
|
0, -1, 1, -1, 0, 1}};
|
||||||
-1, 0, 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for (auto& m : m_lTouchDevices) {
|
for (auto& m : m_lTouchDevices) {
|
||||||
const auto PTOUCHDEV = &m;
|
const auto PTOUCHDEV = &m;
|
||||||
|
|
||||||
@ -1145,7 +1133,8 @@ void CInputManager::setTouchDeviceConfigs() {
|
|||||||
if (wlr_input_device_is_libinput(m.pWlrDevice)) {
|
if (wlr_input_device_is_libinput(m.pWlrDevice)) {
|
||||||
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.pWlrDevice);
|
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.pWlrDevice);
|
||||||
|
|
||||||
const int ROTATION = std::clamp(HASCONFIG ? g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "touch_transform") : g_pConfigManager->getInt("input:touchdevice:transform"), 0, 7);
|
const int ROTATION =
|
||||||
|
std::clamp(HASCONFIG ? g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "touch_transform") : g_pConfigManager->getInt("input:touchdevice:transform"), 0, 7);
|
||||||
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);
|
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);
|
||||||
|
|
||||||
const auto OUTPUT = HASCONFIG ? g_pConfigManager->getDeviceString(PTOUCHDEV->name, "touch_output") : g_pConfigManager->getString("input:touchdevice:output");
|
const auto OUTPUT = HASCONFIG ? g_pConfigManager->getDeviceString(PTOUCHDEV->name, "touch_output") : g_pConfigManager->getString("input:touchdevice:output");
|
||||||
@ -1169,20 +1158,22 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
|
|||||||
|
|
||||||
Debug::log(LOG, "New switch with name \"%s\" added", pDevice->name);
|
Debug::log(LOG, "New switch with name \"%s\" added", pDevice->name);
|
||||||
|
|
||||||
PNEWDEV->hyprListener_destroy.initCallback(&pDevice->events.destroy, [&](void* owner, void* data) {
|
PNEWDEV->hyprListener_destroy.initCallback(
|
||||||
destroySwitch((SSwitchDevice*)owner);
|
&pDevice->events.destroy, [&](void* owner, void* data) { destroySwitch((SSwitchDevice*)owner); }, PNEWDEV, "SwitchDevice");
|
||||||
}, PNEWDEV, "SwitchDevice");
|
|
||||||
|
|
||||||
const auto PSWITCH = wlr_switch_from_input_device(pDevice);
|
const auto PSWITCH = wlr_switch_from_input_device(pDevice);
|
||||||
|
|
||||||
PNEWDEV->hyprListener_toggle.initCallback(&PSWITCH->events.toggle, [&](void* owner, void* data) {
|
PNEWDEV->hyprListener_toggle.initCallback(
|
||||||
|
&PSWITCH->events.toggle,
|
||||||
|
[&](void* owner, void* data) {
|
||||||
const auto PDEVICE = (SSwitchDevice*)owner;
|
const auto PDEVICE = (SSwitchDevice*)owner;
|
||||||
const auto NAME = std::string(PDEVICE->pWlrDevice->name);
|
const auto NAME = std::string(PDEVICE->pWlrDevice->name);
|
||||||
|
|
||||||
Debug::log(LOG, "Switch %s fired, triggering binds.", NAME.c_str());
|
Debug::log(LOG, "Switch %s fired, triggering binds.", NAME.c_str());
|
||||||
|
|
||||||
g_pKeybindManager->onSwitchEvent(NAME);
|
g_pKeybindManager->onSwitchEvent(NAME);
|
||||||
}, PNEWDEV, "SwitchDevice");
|
},
|
||||||
|
PNEWDEV, "SwitchDevice");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::destroySwitch(SSwitchDevice* pDevice) {
|
void CInputManager::destroySwitch(SSwitchDevice* pDevice) {
|
||||||
@ -1214,22 +1205,28 @@ std::string CInputManager::getNameForNewDevice(std::string internalName) {
|
|||||||
auto proposedNewName = deviceNameToInternalString(internalName);
|
auto proposedNewName = deviceNameToInternalString(internalName);
|
||||||
int dupeno = 0;
|
int dupeno = 0;
|
||||||
|
|
||||||
while (std::find_if(m_lKeyboards.begin(), m_lKeyboards.end(), [&] (const SKeyboard& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lKeyboards.end())
|
while (std::find_if(m_lKeyboards.begin(), m_lKeyboards.end(),
|
||||||
|
[&](const SKeyboard& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lKeyboards.end())
|
||||||
dupeno++;
|
dupeno++;
|
||||||
|
|
||||||
while (std::find_if(m_lMice.begin(), m_lMice.end(), [&] (const SMouse& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lMice.end())
|
while (std::find_if(m_lMice.begin(), m_lMice.end(), [&](const SMouse& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) !=
|
||||||
|
m_lMice.end())
|
||||||
dupeno++;
|
dupeno++;
|
||||||
|
|
||||||
while (std::find_if(m_lTouchDevices.begin(), m_lTouchDevices.end(), [&] (const STouchDevice& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTouchDevices.end())
|
while (std::find_if(m_lTouchDevices.begin(), m_lTouchDevices.end(),
|
||||||
|
[&](const STouchDevice& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTouchDevices.end())
|
||||||
dupeno++;
|
dupeno++;
|
||||||
|
|
||||||
while (std::find_if(m_lTabletPads.begin(), m_lTabletPads.end(), [&] (const STabletPad& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTabletPads.end())
|
while (std::find_if(m_lTabletPads.begin(), m_lTabletPads.end(),
|
||||||
|
[&](const STabletPad& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTabletPads.end())
|
||||||
dupeno++;
|
dupeno++;
|
||||||
|
|
||||||
while (std::find_if(m_lTablets.begin(), m_lTablets.end(), [&] (const STablet& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTablets.end())
|
while (std::find_if(m_lTablets.begin(), m_lTablets.end(),
|
||||||
|
[&](const STablet& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTablets.end())
|
||||||
dupeno++;
|
dupeno++;
|
||||||
|
|
||||||
while (std::find_if(m_lTabletTools.begin(), m_lTabletTools.end(), [&] (const STabletTool& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTabletTools.end())
|
while (std::find_if(m_lTabletTools.begin(), m_lTabletTools.end(),
|
||||||
|
[&](const STabletTool& other) { return other.name == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_lTabletTools.end())
|
||||||
dupeno++;
|
dupeno++;
|
||||||
|
|
||||||
return proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno)));
|
return proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno)));
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
#include "../../helpers/Timer.hpp"
|
#include "../../helpers/Timer.hpp"
|
||||||
#include "InputMethodRelay.hpp"
|
#include "InputMethodRelay.hpp"
|
||||||
|
|
||||||
enum eClickBehaviorMode {
|
enum eClickBehaviorMode
|
||||||
|
{
|
||||||
CLICKMODE_DEFAULT = 0,
|
CLICKMODE_DEFAULT = 0,
|
||||||
CLICKMODE_KILL
|
CLICKMODE_KILL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eMouseBindMode {
|
enum eMouseBindMode
|
||||||
|
{
|
||||||
MBIND_INVALID = -1,
|
MBIND_INVALID = -1,
|
||||||
MBIND_MOVE = 0,
|
MBIND_MOVE = 0,
|
||||||
MBIND_RESIZE
|
MBIND_RESIZE
|
||||||
@ -29,7 +31,6 @@ class CKeybindManager;
|
|||||||
|
|
||||||
class CInputManager {
|
class CInputManager {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void onMouseMoved(wlr_pointer_motion_event*);
|
void onMouseMoved(wlr_pointer_motion_event*);
|
||||||
void onMouseWarp(wlr_pointer_motion_absolute_event*);
|
void onMouseWarp(wlr_pointer_motion_absolute_event*);
|
||||||
void onMouseButton(wlr_pointer_button_event*);
|
void onMouseButton(wlr_pointer_button_event*);
|
||||||
@ -136,7 +137,6 @@ public:
|
|||||||
std::string getNameForNewDevice(std::string);
|
std::string getNameForNewDevice(std::string);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_bCursorImageOverriden = false;
|
bool m_bCursorImageOverriden = false;
|
||||||
|
|
||||||
// for click behavior override
|
// for click behavior override
|
||||||
|
@ -15,8 +15,9 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
|
|||||||
|
|
||||||
m_pWLRIME = pIME;
|
m_pWLRIME = pIME;
|
||||||
|
|
||||||
hyprListener_IMECommit.initCallback(&m_pWLRIME->events.commit, [&](void* owner, void* data) {
|
hyprListener_IMECommit.initCallback(
|
||||||
|
&m_pWLRIME->events.commit,
|
||||||
|
[&](void* owner, void* data) {
|
||||||
const auto PTI = getFocusedTextInput();
|
const auto PTI = getFocusedTextInput();
|
||||||
const auto PIMR = (CInputMethodRelay*)owner;
|
const auto PIMR = (CInputMethodRelay*)owner;
|
||||||
|
|
||||||
@ -26,7 +27,8 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PIMR->m_pWLRIME->current.preedit.text) {
|
if (PIMR->m_pWLRIME->current.preedit.text) {
|
||||||
wlr_text_input_v3_send_preedit_string(PTI->pWlrInput, PIMR->m_pWLRIME->current.preedit.text, PIMR->m_pWLRIME->current.preedit.cursor_begin, PIMR->m_pWLRIME->current.preedit.cursor_end);
|
wlr_text_input_v3_send_preedit_string(PTI->pWlrInput, PIMR->m_pWLRIME->current.preedit.text, PIMR->m_pWLRIME->current.preedit.cursor_begin,
|
||||||
|
PIMR->m_pWLRIME->current.preedit.cursor_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PIMR->m_pWLRIME->current.commit_text) {
|
if (PIMR->m_pWLRIME->current.commit_text) {
|
||||||
@ -38,11 +40,12 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wlr_text_input_v3_send_done(PTI->pWlrInput);
|
wlr_text_input_v3_send_done(PTI->pWlrInput);
|
||||||
|
},
|
||||||
|
this, "IMERelay");
|
||||||
|
|
||||||
}, this, "IMERelay");
|
hyprListener_IMEDestroy.initCallback(
|
||||||
|
&m_pWLRIME->events.destroy,
|
||||||
hyprListener_IMEDestroy.initCallback(&m_pWLRIME->events.destroy, [&](void* owner, void* data) {
|
[&](void* owner, void* data) {
|
||||||
|
|
||||||
m_pWLRIME = nullptr;
|
m_pWLRIME = nullptr;
|
||||||
|
|
||||||
hyprListener_IMEDestroy.removeCallback();
|
hyprListener_IMEDestroy.removeCallback();
|
||||||
@ -61,11 +64,12 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
|
|||||||
|
|
||||||
wlr_text_input_v3_send_leave(PTI->pWlrInput);
|
wlr_text_input_v3_send_leave(PTI->pWlrInput);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
this, "IMERelay");
|
||||||
|
|
||||||
}, this, "IMERelay");
|
hyprListener_IMEGrab.initCallback(
|
||||||
|
&m_pWLRIME->events.grab_keyboard,
|
||||||
hyprListener_IMEGrab.initCallback(&m_pWLRIME->events.grab_keyboard, [&](void* owner, void* data) {
|
[&](void* owner, void* data) {
|
||||||
|
|
||||||
Debug::log(LOG, "IME TextInput Keyboard Grab new");
|
Debug::log(LOG, "IME TextInput Keyboard Grab new");
|
||||||
|
|
||||||
m_pKeyboardGrab.reset(nullptr);
|
m_pKeyboardGrab.reset(nullptr);
|
||||||
@ -80,8 +84,9 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
|
|||||||
|
|
||||||
wlr_input_method_keyboard_grab_v2_set_keyboard(m_pKeyboardGrab->pWlrKbGrab, m_pKeyboardGrab->pKeyboard);
|
wlr_input_method_keyboard_grab_v2_set_keyboard(m_pKeyboardGrab->pWlrKbGrab, m_pKeyboardGrab->pKeyboard);
|
||||||
|
|
||||||
m_pKeyboardGrab->hyprListener_grabDestroy.initCallback(&PKBGRAB->events.destroy, [&](void* owner, void* data) {
|
m_pKeyboardGrab->hyprListener_grabDestroy.initCallback(
|
||||||
|
&PKBGRAB->events.destroy,
|
||||||
|
[&](void* owner, void* data) {
|
||||||
m_pKeyboardGrab->hyprListener_grabDestroy.removeCallback();
|
m_pKeyboardGrab->hyprListener_grabDestroy.removeCallback();
|
||||||
|
|
||||||
Debug::log(LOG, "IME TextInput Keyboard Grab destroy");
|
Debug::log(LOG, "IME TextInput Keyboard Grab destroy");
|
||||||
@ -91,13 +96,14 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_pKeyboardGrab.reset(nullptr);
|
m_pKeyboardGrab.reset(nullptr);
|
||||||
|
},
|
||||||
|
m_pKeyboardGrab.get(), "IME Keyboard Grab");
|
||||||
|
},
|
||||||
|
this, "IMERelay");
|
||||||
|
|
||||||
}, m_pKeyboardGrab.get(), "IME Keyboard Grab");
|
hyprListener_IMENewPopup.initCallback(
|
||||||
|
&m_pWLRIME->events.new_popup_surface,
|
||||||
}, this, "IMERelay");
|
[&](void* owner, void* data) {
|
||||||
|
|
||||||
hyprListener_IMENewPopup.initCallback(&m_pWLRIME->events.new_popup_surface, [&](void* owner, void* data) {
|
|
||||||
|
|
||||||
const auto PNEWPOPUP = &m_lIMEPopups.emplace_back();
|
const auto PNEWPOPUP = &m_lIMEPopups.emplace_back();
|
||||||
|
|
||||||
PNEWPOPUP->pSurface = (wlr_input_popup_surface_v2*)data;
|
PNEWPOPUP->pSurface = (wlr_input_popup_surface_v2*)data;
|
||||||
@ -108,8 +114,8 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
|
|||||||
PNEWPOPUP->hyprListener_destroyPopup.initCallback(&PNEWPOPUP->pSurface->events.destroy, &Events::listener_destroyInputPopup, PNEWPOPUP, "IME Popup");
|
PNEWPOPUP->hyprListener_destroyPopup.initCallback(&PNEWPOPUP->pSurface->events.destroy, &Events::listener_destroyInputPopup, PNEWPOPUP, "IME Popup");
|
||||||
|
|
||||||
Debug::log(LOG, "New input popup");
|
Debug::log(LOG, "New input popup");
|
||||||
|
},
|
||||||
}, this, "IMERelay");
|
this, "IMERelay");
|
||||||
|
|
||||||
const auto PTI = getFocusableTextInput();
|
const auto PTI = getFocusableTextInput();
|
||||||
|
|
||||||
@ -296,8 +302,9 @@ void CInputMethodRelay::createNewTextInput(wlr_text_input_v3* pInput) {
|
|||||||
|
|
||||||
PTEXTINPUT->pWlrInput = pInput;
|
PTEXTINPUT->pWlrInput = pInput;
|
||||||
|
|
||||||
PTEXTINPUT->hyprListener_textInputEnable.initCallback(&pInput->events.enable, [](void* owner, void* data) {
|
PTEXTINPUT->hyprListener_textInputEnable.initCallback(
|
||||||
|
&pInput->events.enable,
|
||||||
|
[](void* owner, void* data) {
|
||||||
const auto PINPUT = (STextInput*)owner;
|
const auto PINPUT = (STextInput*)owner;
|
||||||
|
|
||||||
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
||||||
@ -309,11 +316,12 @@ void CInputMethodRelay::createNewTextInput(wlr_text_input_v3* pInput) {
|
|||||||
|
|
||||||
wlr_input_method_v2_send_activate(g_pInputManager->m_sIMERelay.m_pWLRIME);
|
wlr_input_method_v2_send_activate(g_pInputManager->m_sIMERelay.m_pWLRIME);
|
||||||
g_pInputManager->m_sIMERelay.commitIMEState(PINPUT->pWlrInput);
|
g_pInputManager->m_sIMERelay.commitIMEState(PINPUT->pWlrInput);
|
||||||
|
},
|
||||||
|
PTEXTINPUT, "textInput");
|
||||||
|
|
||||||
}, PTEXTINPUT, "textInput");
|
PTEXTINPUT->hyprListener_textInputCommit.initCallback(
|
||||||
|
&pInput->events.commit,
|
||||||
PTEXTINPUT->hyprListener_textInputCommit.initCallback(&pInput->events.commit, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
|
|
||||||
const auto PINPUT = (STextInput*)owner;
|
const auto PINPUT = (STextInput*)owner;
|
||||||
|
|
||||||
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
||||||
@ -327,11 +335,12 @@ void CInputMethodRelay::createNewTextInput(wlr_text_input_v3* pInput) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_pInputManager->m_sIMERelay.commitIMEState(PINPUT->pWlrInput);
|
g_pInputManager->m_sIMERelay.commitIMEState(PINPUT->pWlrInput);
|
||||||
|
},
|
||||||
|
PTEXTINPUT, "textInput");
|
||||||
|
|
||||||
}, PTEXTINPUT, "textInput");
|
PTEXTINPUT->hyprListener_textInputDisable.initCallback(
|
||||||
|
&pInput->events.disable,
|
||||||
PTEXTINPUT->hyprListener_textInputDisable.initCallback(&pInput->events.disable, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
|
|
||||||
const auto PINPUT = (STextInput*)owner;
|
const auto PINPUT = (STextInput*)owner;
|
||||||
|
|
||||||
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
||||||
@ -344,11 +353,12 @@ void CInputMethodRelay::createNewTextInput(wlr_text_input_v3* pInput) {
|
|||||||
wlr_input_method_v2_send_deactivate(g_pInputManager->m_sIMERelay.m_pWLRIME);
|
wlr_input_method_v2_send_deactivate(g_pInputManager->m_sIMERelay.m_pWLRIME);
|
||||||
|
|
||||||
g_pInputManager->m_sIMERelay.commitIMEState(PINPUT->pWlrInput);
|
g_pInputManager->m_sIMERelay.commitIMEState(PINPUT->pWlrInput);
|
||||||
|
},
|
||||||
|
PTEXTINPUT, "textInput");
|
||||||
|
|
||||||
}, PTEXTINPUT, "textInput");
|
PTEXTINPUT->hyprListener_textInputDestroy.initCallback(
|
||||||
|
&pInput->events.destroy,
|
||||||
PTEXTINPUT->hyprListener_textInputDestroy.initCallback(&pInput->events.destroy, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
|
|
||||||
const auto PINPUT = (STextInput*)owner;
|
const auto PINPUT = (STextInput*)owner;
|
||||||
|
|
||||||
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
if (!g_pInputManager->m_sIMERelay.m_pWLRIME) {
|
||||||
@ -370,8 +380,8 @@ void CInputMethodRelay::createNewTextInput(wlr_text_input_v3* pInput) {
|
|||||||
PINPUT->hyprListener_textInputEnable.removeCallback();
|
PINPUT->hyprListener_textInputEnable.removeCallback();
|
||||||
|
|
||||||
g_pInputManager->m_sIMERelay.removeTextInput(PINPUT->pWlrInput);
|
g_pInputManager->m_sIMERelay.removeTextInput(PINPUT->pWlrInput);
|
||||||
|
},
|
||||||
}, PTEXTINPUT, "textInput");
|
PTEXTINPUT, "textInput");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputMethodRelay::removeTextInput(wlr_text_input_v3* pInput) {
|
void CInputMethodRelay::removeTextInput(wlr_text_input_v3* pInput) {
|
||||||
@ -417,7 +427,6 @@ void CInputMethodRelay::onKeyboardFocus(wlr_surface* pSurface) {
|
|||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSurface && wl_resource_get_client(ti.pWlrInput->resource) == wl_resource_get_client(pSurface->resource)) {
|
if (pSurface && wl_resource_get_client(ti.pWlrInput->resource) == wl_resource_get_client(pSurface->resource)) {
|
||||||
@ -427,7 +436,6 @@ void CInputMethodRelay::onKeyboardFocus(wlr_surface* pSurface) {
|
|||||||
} else {
|
} else {
|
||||||
setPendingSurface(&ti, pSurface);
|
setPendingSurface(&ti, pSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,13 +444,16 @@ void CInputMethodRelay::setPendingSurface(STextInput* pInput, wlr_surface* pSurf
|
|||||||
pInput->pPendingSurface = pSurface;
|
pInput->pPendingSurface = pSurface;
|
||||||
|
|
||||||
if (pSurface) {
|
if (pSurface) {
|
||||||
pInput->hyprListener_pendingSurfaceDestroy.initCallback(&pSurface->events.destroy, [](void* owner, void* data) {
|
pInput->hyprListener_pendingSurfaceDestroy.initCallback(
|
||||||
|
&pSurface->events.destroy,
|
||||||
|
[](void* owner, void* data) {
|
||||||
const auto PINPUT = (STextInput*)owner;
|
const auto PINPUT = (STextInput*)owner;
|
||||||
|
|
||||||
PINPUT->pPendingSurface = nullptr;
|
PINPUT->pPendingSurface = nullptr;
|
||||||
|
|
||||||
PINPUT->hyprListener_pendingSurfaceDestroy.removeCallback();
|
PINPUT->hyprListener_pendingSurfaceDestroy.removeCallback();
|
||||||
}, pInput, "TextInput");
|
},
|
||||||
|
pInput, "TextInput");
|
||||||
} else {
|
} else {
|
||||||
pInput->hyprListener_pendingSurfaceDestroy.removeCallback();
|
pInput->hyprListener_pendingSurfaceDestroy.removeCallback();
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ public:
|
|||||||
void removePopup(SIMEPopup*);
|
void removePopup(SIMEPopup*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::unique_ptr<SIMEKbGrab> m_pKeyboardGrab;
|
std::unique_ptr<SIMEKbGrab> m_pKeyboardGrab;
|
||||||
|
|
||||||
std::list<STextInput> m_lTextInputs;
|
std::list<STextInput> m_lTextInputs;
|
||||||
|
@ -55,7 +55,8 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||||||
auto workspaceIDLeft = getWorkspaceIDFromString("m-1", wsname);
|
auto workspaceIDLeft = getWorkspaceIDFromString("m-1", wsname);
|
||||||
auto workspaceIDRight = getWorkspaceIDFromString("m+1", wsname);
|
auto workspaceIDRight = getWorkspaceIDFromString("m+1", wsname);
|
||||||
|
|
||||||
if ((workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID || (workspaceIDRight == workspaceIDLeft && workspaceIDLeft == m_sActiveSwipe.pWorkspaceBegin->m_iID)) && *PSWIPENEW) {
|
if ((workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID || (workspaceIDRight == workspaceIDLeft && workspaceIDLeft == m_sActiveSwipe.pWorkspaceBegin->m_iID)) &&
|
||||||
|
*PSWIPENEW) {
|
||||||
workspaceIDRight = m_sActiveSwipe.pWorkspaceBegin->m_iID > 0 ? m_sActiveSwipe.pWorkspaceBegin->m_iID + 1 : 1;
|
workspaceIDRight = m_sActiveSwipe.pWorkspaceBegin->m_iID > 0 ? m_sActiveSwipe.pWorkspaceBegin->m_iID + 1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +67,8 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||||||
|
|
||||||
CWorkspace* pSwitchedTo = nullptr;
|
CWorkspace* pSwitchedTo = nullptr;
|
||||||
|
|
||||||
if ((abs(m_sActiveSwipe.delta) < *PSWIPEDIST * *PSWIPEPERC && (*PSWIPEFORC == 0 || (*PSWIPEFORC != 0 && m_sActiveSwipe.avgSpeed < *PSWIPEFORC))) || abs(m_sActiveSwipe.delta) < 2) {
|
if ((abs(m_sActiveSwipe.delta) < *PSWIPEDIST * *PSWIPEPERC && (*PSWIPEFORC == 0 || (*PSWIPEFORC != 0 && m_sActiveSwipe.avgSpeed < *PSWIPEFORC))) ||
|
||||||
|
abs(m_sActiveSwipe.delta) < 2) {
|
||||||
// revert
|
// revert
|
||||||
if (abs(m_sActiveSwipe.delta) < 2) {
|
if (abs(m_sActiveSwipe.delta) < 2) {
|
||||||
PWORKSPACEL->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
PWORKSPACEL->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
@ -189,7 +191,8 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||||||
m_sActiveSwipe.delta = std::clamp(m_sActiveSwipe.delta, (double)-*PSWIPEDIST, (double)*PSWIPEDIST);
|
m_sActiveSwipe.delta = std::clamp(m_sActiveSwipe.delta, (double)-*PSWIPEDIST, (double)*PSWIPEDIST);
|
||||||
|
|
||||||
if ((m_sActiveSwipe.pWorkspaceBegin->m_iID == workspaceIDLeft && *PSWIPENEW && (m_sActiveSwipe.delta < 0)) ||
|
if ((m_sActiveSwipe.pWorkspaceBegin->m_iID == workspaceIDLeft && *PSWIPENEW && (m_sActiveSwipe.delta < 0)) ||
|
||||||
(m_sActiveSwipe.delta > 0 && g_pCompositor->getWindowsOnWorkspace(m_sActiveSwipe.pWorkspaceBegin->m_iID) == 0 && workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID) ||
|
(m_sActiveSwipe.delta > 0 && g_pCompositor->getWindowsOnWorkspace(m_sActiveSwipe.pWorkspaceBegin->m_iID) == 0 &&
|
||||||
|
workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID) ||
|
||||||
(m_sActiveSwipe.delta < 0 && m_sActiveSwipe.pWorkspaceBegin->m_iID <= workspaceIDLeft)) {
|
(m_sActiveSwipe.delta < 0 && m_sActiveSwipe.pWorkspaceBegin->m_iID <= workspaceIDLeft)) {
|
||||||
|
|
||||||
m_sActiveSwipe.delta = 0;
|
m_sActiveSwipe.delta = 0;
|
||||||
@ -215,10 +218,12 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VERTANIMS) {
|
if (VERTANIMS) {
|
||||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y - m_sActiveSwipe.pMonitor->vecSize.y));
|
PWORKSPACE->m_vRenderOffset.setValueAndWarp(
|
||||||
|
Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y - m_sActiveSwipe.pMonitor->vecSize.y));
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y));
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y));
|
||||||
} else {
|
} else {
|
||||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x - m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
PWORKSPACE->m_vRenderOffset.setValueAndWarp(
|
||||||
|
Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x - m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,10 +258,12 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VERTANIMS) {
|
if (VERTANIMS) {
|
||||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y + m_sActiveSwipe.pMonitor->vecSize.y));
|
PWORKSPACE->m_vRenderOffset.setValueAndWarp(
|
||||||
|
Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y + m_sActiveSwipe.pMonitor->vecSize.y));
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y));
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.y));
|
||||||
} else {
|
} else {
|
||||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x + m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
PWORKSPACE->m_vRenderOffset.setValueAndWarp(
|
||||||
|
Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x + m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,16 +19,20 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
|
|||||||
|
|
||||||
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, pDevice);
|
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, pDevice);
|
||||||
|
|
||||||
PNEWTABLET->hyprListener_Destroy.initCallback(&pDevice->events.destroy, [](void* owner, void* data) {
|
PNEWTABLET->hyprListener_Destroy.initCallback(
|
||||||
|
&pDevice->events.destroy,
|
||||||
|
[](void* owner, void* data) {
|
||||||
const auto PTAB = (STablet*)owner;
|
const auto PTAB = (STablet*)owner;
|
||||||
|
|
||||||
g_pInputManager->m_lTablets.remove(*PTAB);
|
g_pInputManager->m_lTablets.remove(*PTAB);
|
||||||
|
|
||||||
Debug::log(LOG, "Removed a tablet");
|
Debug::log(LOG, "Removed a tablet");
|
||||||
}, PNEWTABLET, "Tablet");
|
},
|
||||||
|
PNEWTABLET, "Tablet");
|
||||||
PNEWTABLET->hyprListener_Axis.initCallback(&wlr_tablet_from_input_device(pDevice)->events.axis, [](void* owner, void* data) {
|
|
||||||
|
|
||||||
|
PNEWTABLET->hyprListener_Axis.initCallback(
|
||||||
|
&wlr_tablet_from_input_device(pDevice)->events.axis,
|
||||||
|
[](void* owner, void* data) {
|
||||||
const auto EVENT = (wlr_tablet_tool_axis_event*)data;
|
const auto EVENT = (wlr_tablet_tool_axis_event*)data;
|
||||||
const auto PTAB = (STablet*)owner;
|
const auto PTAB = (STablet*)owner;
|
||||||
|
|
||||||
@ -77,10 +81,12 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
|
|||||||
|
|
||||||
if (EVENT->updated_axes & (WLR_TABLET_TOOL_AXIS_TILT_X | WLR_TABLET_TOOL_AXIS_TILT_Y))
|
if (EVENT->updated_axes & (WLR_TABLET_TOOL_AXIS_TILT_X | WLR_TABLET_TOOL_AXIS_TILT_Y))
|
||||||
wlr_tablet_v2_tablet_tool_notify_tilt(PTOOL->wlrTabletToolV2, PTOOL->tiltX, PTOOL->tiltY);
|
wlr_tablet_v2_tablet_tool_notify_tilt(PTOOL->wlrTabletToolV2, PTOOL->tiltX, PTOOL->tiltY);
|
||||||
|
},
|
||||||
|
PNEWTABLET, "Tablet");
|
||||||
|
|
||||||
}, PNEWTABLET, "Tablet");
|
PNEWTABLET->hyprListener_Tip.initCallback(
|
||||||
|
&wlr_tablet_from_input_device(pDevice)->events.tip,
|
||||||
PNEWTABLET->hyprListener_Tip.initCallback(&wlr_tablet_from_input_device(pDevice)->events.tip, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
const auto EVENT = (wlr_tablet_tool_tip_event*)data;
|
const auto EVENT = (wlr_tablet_tool_tip_event*)data;
|
||||||
const auto PTAB = (STablet*)owner;
|
const auto PTAB = (STablet*)owner;
|
||||||
|
|
||||||
@ -91,23 +97,26 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
|
|||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
g_pInputManager->focusTablet(PTAB, EVENT->tool);
|
g_pInputManager->focusTablet(PTAB, EVENT->tool);
|
||||||
wlr_send_tablet_v2_tablet_tool_down(PTOOL->wlrTabletToolV2);
|
wlr_send_tablet_v2_tablet_tool_down(PTOOL->wlrTabletToolV2);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wlr_send_tablet_v2_tablet_tool_up(PTOOL->wlrTabletToolV2);
|
wlr_send_tablet_v2_tablet_tool_up(PTOOL->wlrTabletToolV2);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
PNEWTABLET, "Tablet");
|
||||||
|
|
||||||
}, PNEWTABLET, "Tablet");
|
PNEWTABLET->hyprListener_Button.initCallback(
|
||||||
|
&wlr_tablet_from_input_device(pDevice)->events.button,
|
||||||
PNEWTABLET->hyprListener_Button.initCallback(&wlr_tablet_from_input_device(pDevice)->events.button, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
const auto EVENT = (wlr_tablet_tool_button_event*)data;
|
const auto EVENT = (wlr_tablet_tool_button_event*)data;
|
||||||
|
|
||||||
const auto PTOOL = g_pInputManager->ensureTabletToolPresent(EVENT->tool);
|
const auto PTOOL = g_pInputManager->ensureTabletToolPresent(EVENT->tool);
|
||||||
|
|
||||||
wlr_tablet_v2_tablet_tool_notify_button(PTOOL->wlrTabletToolV2, (zwp_tablet_pad_v2_button_state)EVENT->button, (zwp_tablet_pad_v2_button_state)EVENT->state);
|
wlr_tablet_v2_tablet_tool_notify_button(PTOOL->wlrTabletToolV2, (zwp_tablet_pad_v2_button_state)EVENT->button, (zwp_tablet_pad_v2_button_state)EVENT->state);
|
||||||
|
},
|
||||||
|
PNEWTABLET, "Tablet");
|
||||||
|
|
||||||
}, PNEWTABLET, "Tablet");
|
PNEWTABLET->hyprListener_Proximity.initCallback(
|
||||||
|
&wlr_tablet_from_input_device(pDevice)->events.proximity,
|
||||||
PNEWTABLET->hyprListener_Proximity.initCallback(&wlr_tablet_from_input_device(pDevice)->events.proximity, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
const auto EVENT = (wlr_tablet_tool_proximity_event*)data;
|
const auto EVENT = (wlr_tablet_tool_proximity_event*)data;
|
||||||
const auto PTAB = (STablet*)owner;
|
const auto PTAB = (STablet*)owner;
|
||||||
|
|
||||||
@ -126,8 +135,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
|
|||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
g_pInputManager->focusTablet(PTAB, EVENT->tool);
|
g_pInputManager->focusTablet(PTAB, EVENT->tool);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
}, PNEWTABLET, "Tablet");
|
PNEWTABLET, "Tablet");
|
||||||
}
|
}
|
||||||
|
|
||||||
STabletTool* CInputManager::ensureTabletToolPresent(wlr_tablet_tool* pTool) {
|
STabletTool* CInputManager::ensureTabletToolPresent(wlr_tablet_tool* pTool) {
|
||||||
@ -141,12 +150,15 @@ STabletTool* CInputManager::ensureTabletToolPresent(wlr_tablet_tool* pTool) {
|
|||||||
|
|
||||||
PTOOL->wlrTabletToolV2 = wlr_tablet_tool_create(g_pCompositor->m_sWLRTabletManager, g_pCompositor->m_sSeat.seat, pTool);
|
PTOOL->wlrTabletToolV2 = wlr_tablet_tool_create(g_pCompositor->m_sWLRTabletManager, g_pCompositor->m_sSeat.seat, pTool);
|
||||||
|
|
||||||
PTOOL->hyprListener_TabletToolDestroy.initCallback(&pTool->events.destroy, [](void* owner, void* data) {
|
PTOOL->hyprListener_TabletToolDestroy.initCallback(
|
||||||
|
&pTool->events.destroy,
|
||||||
|
[](void* owner, void* data) {
|
||||||
const auto PTOOL = (STabletTool*)owner;
|
const auto PTOOL = (STabletTool*)owner;
|
||||||
|
|
||||||
PTOOL->wlrTabletTool->data = nullptr;
|
PTOOL->wlrTabletTool->data = nullptr;
|
||||||
g_pInputManager->m_lTabletTools.remove(*PTOOL);
|
g_pInputManager->m_lTabletTools.remove(*PTOOL);
|
||||||
}, PTOOL, "Tablet Tool V1");
|
},
|
||||||
|
PTOOL, "Tablet Tool V1");
|
||||||
|
|
||||||
//TODO: set cursor request
|
//TODO: set cursor request
|
||||||
}
|
}
|
||||||
@ -165,36 +177,40 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) {
|
|||||||
|
|
||||||
PNEWPAD->wlrTabletPadV2 = wlr_tablet_pad_create(g_pCompositor->m_sWLRTabletManager, g_pCompositor->m_sSeat.seat, pDevice);
|
PNEWPAD->wlrTabletPadV2 = wlr_tablet_pad_create(g_pCompositor->m_sWLRTabletManager, g_pCompositor->m_sSeat.seat, pDevice);
|
||||||
|
|
||||||
PNEWPAD->hyprListener_Button.initCallback(&wlr_tablet_pad_from_input_device(pDevice)->events.button, [](void* owner, void* data) {
|
PNEWPAD->hyprListener_Button.initCallback(
|
||||||
|
&wlr_tablet_pad_from_input_device(pDevice)->events.button,
|
||||||
|
[](void* owner, void* data) {
|
||||||
const auto EVENT = (wlr_tablet_pad_button_event*)data;
|
const auto EVENT = (wlr_tablet_pad_button_event*)data;
|
||||||
const auto PPAD = (STabletPad*)owner;
|
const auto PPAD = (STabletPad*)owner;
|
||||||
|
|
||||||
wlr_tablet_v2_tablet_pad_notify_mode(PPAD->wlrTabletPadV2, EVENT->group, EVENT->mode, EVENT->time_msec);
|
wlr_tablet_v2_tablet_pad_notify_mode(PPAD->wlrTabletPadV2, EVENT->group, EVENT->mode, EVENT->time_msec);
|
||||||
wlr_tablet_v2_tablet_pad_notify_button(PPAD->wlrTabletPadV2, EVENT->button, EVENT->time_msec, (zwp_tablet_pad_v2_button_state)EVENT->state);
|
wlr_tablet_v2_tablet_pad_notify_button(PPAD->wlrTabletPadV2, EVENT->button, EVENT->time_msec, (zwp_tablet_pad_v2_button_state)EVENT->state);
|
||||||
|
},
|
||||||
|
PNEWPAD, "Tablet Pad");
|
||||||
|
|
||||||
}, PNEWPAD, "Tablet Pad");
|
PNEWPAD->hyprListener_Strip.initCallback(
|
||||||
|
&wlr_tablet_pad_from_input_device(pDevice)->events.strip,
|
||||||
PNEWPAD->hyprListener_Strip.initCallback(&wlr_tablet_pad_from_input_device(pDevice)->events.strip, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
|
|
||||||
const auto EVENT = (wlr_tablet_pad_strip_event*)data;
|
const auto EVENT = (wlr_tablet_pad_strip_event*)data;
|
||||||
const auto PPAD = (STabletPad*)owner;
|
const auto PPAD = (STabletPad*)owner;
|
||||||
|
|
||||||
wlr_tablet_v2_tablet_pad_notify_strip(PPAD->wlrTabletPadV2, EVENT->strip, EVENT->position, EVENT->source == WLR_TABLET_PAD_STRIP_SOURCE_FINGER, EVENT->time_msec);
|
wlr_tablet_v2_tablet_pad_notify_strip(PPAD->wlrTabletPadV2, EVENT->strip, EVENT->position, EVENT->source == WLR_TABLET_PAD_STRIP_SOURCE_FINGER, EVENT->time_msec);
|
||||||
|
},
|
||||||
|
PNEWPAD, "Tablet Pad");
|
||||||
|
|
||||||
}, PNEWPAD, "Tablet Pad");
|
PNEWPAD->hyprListener_Ring.initCallback(
|
||||||
|
&wlr_tablet_pad_from_input_device(pDevice)->events.strip,
|
||||||
PNEWPAD->hyprListener_Ring.initCallback(&wlr_tablet_pad_from_input_device(pDevice)->events.strip, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
|
|
||||||
const auto EVENT = (wlr_tablet_pad_ring_event*)data;
|
const auto EVENT = (wlr_tablet_pad_ring_event*)data;
|
||||||
const auto PPAD = (STabletPad*)owner;
|
const auto PPAD = (STabletPad*)owner;
|
||||||
|
|
||||||
wlr_tablet_v2_tablet_pad_notify_ring(PPAD->wlrTabletPadV2, EVENT->ring, EVENT->position, EVENT->source == WLR_TABLET_PAD_RING_SOURCE_FINGER, EVENT->time_msec);
|
wlr_tablet_v2_tablet_pad_notify_ring(PPAD->wlrTabletPadV2, EVENT->ring, EVENT->position, EVENT->source == WLR_TABLET_PAD_RING_SOURCE_FINGER, EVENT->time_msec);
|
||||||
|
},
|
||||||
|
PNEWPAD, "Tablet Pad");
|
||||||
|
|
||||||
}, PNEWPAD, "Tablet Pad");
|
PNEWPAD->hyprListener_Attach.initCallback(
|
||||||
|
&wlr_tablet_pad_from_input_device(pDevice)->events.strip,
|
||||||
PNEWPAD->hyprListener_Attach.initCallback(&wlr_tablet_pad_from_input_device(pDevice)->events.strip, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
|
|
||||||
const auto TABLET = (wlr_tablet_tool*)data;
|
const auto TABLET = (wlr_tablet_tool*)data;
|
||||||
const auto PPAD = (STabletPad*)owner;
|
const auto PPAD = (STabletPad*)owner;
|
||||||
|
|
||||||
@ -202,18 +218,19 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) {
|
|||||||
|
|
||||||
if (!PPAD->pTabletParent)
|
if (!PPAD->pTabletParent)
|
||||||
Debug::log(ERR, "tabletpad got attached to a nullptr tablet!! this might be bad.");
|
Debug::log(ERR, "tabletpad got attached to a nullptr tablet!! this might be bad.");
|
||||||
|
},
|
||||||
|
PNEWPAD, "Tablet Pad");
|
||||||
|
|
||||||
}, PNEWPAD, "Tablet Pad");
|
PNEWPAD->hyprListener_Destroy.initCallback(
|
||||||
|
&pDevice->events.destroy,
|
||||||
PNEWPAD->hyprListener_Destroy.initCallback(&pDevice->events.destroy, [](void* owner, void* data) {
|
[](void* owner, void* data) {
|
||||||
|
|
||||||
const auto PPAD = (STabletPad*)owner;
|
const auto PPAD = (STabletPad*)owner;
|
||||||
|
|
||||||
g_pInputManager->m_lTabletPads.remove(*PPAD);
|
g_pInputManager->m_lTabletPads.remove(*PPAD);
|
||||||
|
|
||||||
Debug::log(LOG, "Removed a tablet pad");
|
Debug::log(LOG, "Removed a tablet pad");
|
||||||
|
},
|
||||||
}, PNEWPAD, "Tablet Pad");
|
PNEWPAD, "Tablet Pad");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool motion) {
|
void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool motion) {
|
||||||
|
@ -30,7 +30,8 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) {
|
|||||||
|
|
||||||
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
||||||
} else if (m_sTouchData.touchFocusLS) {
|
} else if (m_sTouchData.touchFocusLS) {
|
||||||
local = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_sTouchData.touchFocusLS->geometry.x, m_sTouchData.touchFocusLS->geometry.y) - g_pCompositor->m_pLastMonitor->vecPosition;
|
local = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_sTouchData.touchFocusLS->geometry.x, m_sTouchData.touchFocusLS->geometry.y) -
|
||||||
|
g_pCompositor->m_pLastMonitor->vecPosition;
|
||||||
|
|
||||||
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
||||||
} else {
|
} else {
|
||||||
@ -52,7 +53,8 @@ void CInputManager::onTouchMove(wlr_touch_motion_event* e){
|
|||||||
if (m_sTouchData.touchFocusWindow && g_pCompositor->windowValidMapped(m_sTouchData.touchFocusWindow)) {
|
if (m_sTouchData.touchFocusWindow && g_pCompositor->windowValidMapped(m_sTouchData.touchFocusWindow)) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusWindow->m_iMonitorID);
|
||||||
|
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x,
|
||||||
|
PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
|
||||||
|
|
||||||
const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
|
const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
|
||||||
|
|
||||||
@ -60,7 +62,8 @@ void CInputManager::onTouchMove(wlr_touch_motion_event* e){
|
|||||||
} else if (m_sTouchData.touchFocusLS) {
|
} else if (m_sTouchData.touchFocusLS) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusLS->monitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusLS->monitorID);
|
||||||
|
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x,
|
||||||
|
PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
|
||||||
|
|
||||||
const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
|
const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@ CToplevelExportProtocolManager::CToplevelExportProtocolManager() {
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, &hyprland_toplevel_export_manager_v1_interface,
|
m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, &hyprland_toplevel_export_manager_v1_interface, TOPLEVEL_EXPORT_VERSION, this, bindManagerInt);
|
||||||
TOPLEVEL_EXPORT_VERSION, this, bindManagerInt);
|
|
||||||
|
|
||||||
if (!m_pGlobal) {
|
if (!m_pGlobal) {
|
||||||
Debug::log(ERR, "ToplevelExportManager could not start! Sharing windows will not work!");
|
Debug::log(ERR, "ToplevelExportManager could not start! Sharing windows will not work!");
|
||||||
@ -72,10 +71,7 @@ static const struct hyprland_toplevel_export_manager_v1_interface toplevelExport
|
|||||||
.capture_toplevel_with_wlr_toplevel_handle = handleCaptureToplevelWithWlr,
|
.capture_toplevel_with_wlr_toplevel_handle = handleCaptureToplevelWithWlr,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct hyprland_toplevel_export_frame_v1_interface toplevelFrameImpl = {
|
static const struct hyprland_toplevel_export_frame_v1_interface toplevelFrameImpl = {.copy = handleCopyFrame, .destroy = handleDestroyFrame};
|
||||||
.copy = handleCopyFrame,
|
|
||||||
.destroy = handleDestroyFrame
|
|
||||||
};
|
|
||||||
|
|
||||||
SToplevelClient* clientFromResource(wl_resource* resource) {
|
SToplevelClient* clientFromResource(wl_resource* resource) {
|
||||||
ASSERT(wl_resource_instance_of(resource, &hyprland_toplevel_export_manager_v1_interface, &toplevelExportManagerImpl));
|
ASSERT(wl_resource_instance_of(resource, &hyprland_toplevel_export_manager_v1_interface, &toplevelExportManagerImpl));
|
||||||
@ -108,8 +104,7 @@ void handleManagerResourceDestroy(wl_resource* resource) {
|
|||||||
void CToplevelExportProtocolManager::bindManager(wl_client* client, void* data, uint32_t version, uint32_t id) {
|
void CToplevelExportProtocolManager::bindManager(wl_client* client, void* data, uint32_t version, uint32_t id) {
|
||||||
const auto PCLIENT = &m_lClients.emplace_back();
|
const auto PCLIENT = &m_lClients.emplace_back();
|
||||||
|
|
||||||
PCLIENT->resource = wl_resource_create(client, &hyprland_toplevel_export_manager_v1_interface,
|
PCLIENT->resource = wl_resource_create(client, &hyprland_toplevel_export_manager_v1_interface, version, id);
|
||||||
version, id);
|
|
||||||
|
|
||||||
if (!PCLIENT->resource) {
|
if (!PCLIENT->resource) {
|
||||||
Debug::log(ERR, "ToplevelExportManager could not bind! (out of memory?)");
|
Debug::log(ERR, "ToplevelExportManager could not bind! (out of memory?)");
|
||||||
@ -295,8 +290,7 @@ void CToplevelExportProtocolManager::onMonitorRender(CMonitor* pMonitor) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_box geometry = { f->pWindow->m_vRealPosition.vec().x, f->pWindow->m_vRealPosition.vec().y,
|
wlr_box geometry = {f->pWindow->m_vRealPosition.vec().x, f->pWindow->m_vRealPosition.vec().y, f->pWindow->m_vRealSize.vec().x, f->pWindow->m_vRealSize.vec().y};
|
||||||
f->pWindow->m_vRealSize.vec().x, f->pWindow->m_vRealSize.vec().y };
|
|
||||||
|
|
||||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
|
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
|
||||||
continue;
|
continue;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
class CFramebuffer {
|
class CFramebuffer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~CFramebuffer();
|
~CFramebuffer();
|
||||||
|
|
||||||
bool alloc(int w, int h);
|
bool alloc(int w, int h);
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include "Shaders.hpp"
|
#include "Shaders.hpp"
|
||||||
|
|
||||||
CHyprOpenGLImpl::CHyprOpenGLImpl() {
|
CHyprOpenGLImpl::CHyprOpenGLImpl() {
|
||||||
RASSERT(eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL)), "Couldn't unset current EGL!");
|
RASSERT(eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL)),
|
||||||
|
"Couldn't unset current EGL!");
|
||||||
|
|
||||||
auto* const EXTENSIONS = (const char*)glGetString(GL_EXTENSIONS);
|
auto* const EXTENSIONS = (const char*)glGetString(GL_EXTENSIONS);
|
||||||
|
|
||||||
@ -373,7 +374,8 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, pixm
|
|||||||
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
|
||||||
|
m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
@ -392,8 +394,8 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, pixm
|
|||||||
glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
||||||
|
|
||||||
wlr_box transformedBox;
|
wlr_box transformedBox;
|
||||||
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform),
|
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
||||||
m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
|
m_RenderData.pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
||||||
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||||
@ -454,7 +456,8 @@ void CHyprOpenGLImpl::renderTexture(const CTexture& tex, wlr_box* pBox, float al
|
|||||||
scissor((wlr_box*)nullptr);
|
scissor((wlr_box*)nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque, bool noAA, bool allowCustomUV, bool allowDim) {
|
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque, bool noAA,
|
||||||
|
bool allowCustomUV, bool allowDim) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
||||||
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
|
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
|
||||||
|
|
||||||
@ -483,17 +486,10 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||||||
usingFinalShader = true;
|
usingFinalShader = true;
|
||||||
} else {
|
} else {
|
||||||
switch (tex.m_iType) {
|
switch (tex.m_iType) {
|
||||||
case TEXTURE_RGBA:
|
case TEXTURE_RGBA: shader = &m_RenderData.pCurrentMonData->m_shRGBA; break;
|
||||||
shader = &m_RenderData.pCurrentMonData->m_shRGBA;
|
case TEXTURE_RGBX: shader = &m_RenderData.pCurrentMonData->m_shRGBX; break;
|
||||||
break;
|
case TEXTURE_EXTERNAL: shader = &m_RenderData.pCurrentMonData->m_shEXT; break;
|
||||||
case TEXTURE_RGBX:
|
default: RASSERT(false, "tex.m_iTarget unsupported!");
|
||||||
shader = &m_RenderData.pCurrentMonData->m_shRGBX;
|
|
||||||
break;
|
|
||||||
case TEXTURE_EXTERNAL:
|
|
||||||
shader = &m_RenderData.pCurrentMonData->m_shEXT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
RASSERT(false, "tex.m_iTarget unsupported!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,8 +513,8 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||||||
}
|
}
|
||||||
|
|
||||||
wlr_box transformedBox;
|
wlr_box transformedBox;
|
||||||
wlr_box_transform(&transformedBox, pBox, wlr_output_transform_invert(m_RenderData.pMonitor->transform),
|
wlr_box_transform(&transformedBox, pBox, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
||||||
m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
|
m_RenderData.pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
||||||
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||||
@ -612,7 +608,8 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
|||||||
pixman_region32_t damage;
|
pixman_region32_t damage;
|
||||||
pixman_region32_init(&damage);
|
pixman_region32_init(&damage);
|
||||||
pixman_region32_copy(&damage, originalDamage);
|
pixman_region32_copy(&damage, originalDamage);
|
||||||
wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
|
wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
||||||
|
m_RenderData.pMonitor->vecTransformedSize.y);
|
||||||
wlr_region_expand(&damage, &damage, pow(2, *PBLURPASSES) * *PBLURSIZE);
|
wlr_region_expand(&damage, &damage, pow(2, *PBLURPASSES) * *PBLURSIZE);
|
||||||
|
|
||||||
// helper
|
// helper
|
||||||
@ -645,9 +642,11 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
|||||||
#endif
|
#endif
|
||||||
glUniform1f(pShader->radius, *PBLURSIZE * (a / 255.f)); // this makes the blursize change with a
|
glUniform1f(pShader->radius, *PBLURSIZE * (a / 255.f)); // this makes the blursize change with a
|
||||||
if (pShader == &m_RenderData.pCurrentMonData->m_shBLUR1)
|
if (pShader == &m_RenderData.pCurrentMonData->m_shBLUR1)
|
||||||
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR1.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f));
|
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR1.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f),
|
||||||
|
0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f));
|
||||||
else
|
else
|
||||||
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR2.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x * 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y * 2.f));
|
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR2.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x * 2.f),
|
||||||
|
0.5f / (m_RenderData.pMonitor->vecPixelSize.y * 2.f));
|
||||||
glUniform1i(pShader->tex, 0);
|
glUniform1i(pShader->tex, 0);
|
||||||
|
|
||||||
glVertexAttribPointer(pShader->posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
glVertexAttribPointer(pShader->posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||||
@ -837,7 +836,8 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||||||
if (!pixman_region32_not_empty(&damage))
|
if (!pixman_region32_not_empty(&damage))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) || (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur)) {
|
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) ||
|
||||||
|
(m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur)) {
|
||||||
renderTexture(tex, pBox, a, round, false, true);
|
renderTexture(tex, pBox, a, round, false, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -861,7 +861,9 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// vvv TODO: layered blur fbs?
|
// vvv TODO: layered blur fbs?
|
||||||
const bool USENEWOPTIMIZE = (*PBLURNEWOPTIMIZE && !blockBlurOptimization && ((m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating) || *PBLURXRAY) && m_RenderData.pCurrentMonData->blurFB.m_cTex.m_iTexID && (!m_pCurrentWindow || !g_pCompositor->isWorkspaceSpecial(m_pCurrentWindow->m_iWorkspaceID) ));
|
const bool USENEWOPTIMIZE =
|
||||||
|
(*PBLURNEWOPTIMIZE && !blockBlurOptimization && ((m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating) || *PBLURXRAY) &&
|
||||||
|
m_RenderData.pCurrentMonData->blurFB.m_cTex.m_iTexID && (!m_pCurrentWindow || !g_pCompositor->isWorkspaceSpecial(m_pCurrentWindow->m_iWorkspaceID)));
|
||||||
|
|
||||||
CFramebuffer* POUTFB = nullptr;
|
CFramebuffer* POUTFB = nullptr;
|
||||||
if (!USENEWOPTIMIZE) {
|
if (!USENEWOPTIMIZE) {
|
||||||
@ -958,7 +960,8 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad,
|
|||||||
round += round == 0 ? 0 : scaledBorderSize;
|
round += round == 0 ? 0 : scaledBorderSize;
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
|
||||||
|
m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
@ -983,8 +986,8 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad,
|
|||||||
glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.alpha, a);
|
glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.alpha, a);
|
||||||
|
|
||||||
wlr_box transformedBox;
|
wlr_box transformedBox;
|
||||||
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform),
|
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
||||||
m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
|
m_RenderData.pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
||||||
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||||
@ -1199,13 +1202,9 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) {
|
|||||||
wlr_output_rollback(PMONITOR->output);
|
wlr_output_rollback(PMONITOR->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::onWindowResizeStart(CWindow* pWindow) {
|
void CHyprOpenGLImpl::onWindowResizeStart(CWindow* pWindow) {}
|
||||||
|
|
||||||
}
|
void CHyprOpenGLImpl::onWindowResizeEnd(CWindow* pWindow) {}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::onWindowResizeEnd(CWindow* pWindow) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
|
void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render snapshot rect without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render snapshot rect without begin()!");
|
||||||
@ -1226,7 +1225,8 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
|
|||||||
wlr_box windowBox;
|
wlr_box windowBox;
|
||||||
// some mafs to figure out the correct box
|
// some mafs to figure out the correct box
|
||||||
// the originalClosedPos is relative to the monitor's pos
|
// the originalClosedPos is relative to the monitor's pos
|
||||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.vec().x / (PWINDOW->m_vOriginalClosedSize.x * PMONITOR->scale)), (PMONITOR->scale * PWINDOW->m_vRealSize.vec().y / (PWINDOW->m_vOriginalClosedSize.y * PMONITOR->scale)));
|
Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.vec().x / (PWINDOW->m_vOriginalClosedSize.x * PMONITOR->scale)),
|
||||||
|
(PMONITOR->scale * PWINDOW->m_vRealSize.vec().y / (PWINDOW->m_vOriginalClosedSize.y * PMONITOR->scale)));
|
||||||
|
|
||||||
windowBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
|
windowBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
|
||||||
windowBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y;
|
windowBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y;
|
||||||
@ -1300,7 +1300,8 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
|
|||||||
const auto col = m_pCurrentWindow->m_cRealShadowColor.col();
|
const auto col = m_pCurrentWindow->m_cRealShadowColor.col();
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
|
||||||
|
m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
|
@ -20,12 +20,7 @@ inline const float fullVerts[] = {
|
|||||||
1, 1, // bottom right
|
1, 1, // bottom right
|
||||||
0, 1, // bottom left
|
0, 1, // bottom left
|
||||||
};
|
};
|
||||||
inline const float fanVertsFull[] = {
|
inline const float fanVertsFull[] = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f};
|
||||||
-1.0f, -1.0f,
|
|
||||||
1.0f, -1.0f,
|
|
||||||
1.0f, 1.0f,
|
|
||||||
-1.0f, 1.0f
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SMonitorRenderData {
|
struct SMonitorRenderData {
|
||||||
CFramebuffer primaryFB;
|
CFramebuffer primaryFB;
|
||||||
@ -72,7 +67,6 @@ class CGradientValueData;
|
|||||||
|
|
||||||
class CHyprOpenGLImpl {
|
class CHyprOpenGLImpl {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CHyprOpenGLImpl();
|
CHyprOpenGLImpl();
|
||||||
|
|
||||||
void begin(CMonitor*, pixman_region32_t*, bool fake = false);
|
void begin(CMonitor*, pixman_region32_t*, bool fake = false);
|
||||||
@ -150,7 +144,8 @@ private:
|
|||||||
// returns the out FB, can be either Mirror or MirrorSwap
|
// returns the out FB, can be either Mirror or MirrorSwap
|
||||||
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
||||||
|
|
||||||
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false, bool noAA = false, bool allowCustomUV = false, bool allowDim = false);
|
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false, bool noAA = false,
|
||||||
|
bool allowCustomUV = false, bool allowDim = false);
|
||||||
void renderSplash(cairo_t* const, cairo_surface_t* const, double);
|
void renderSplash(cairo_t* const, cairo_surface_t* const, double);
|
||||||
|
|
||||||
void preBlurForCurrentMonitor();
|
void preBlurForCurrentMonitor();
|
||||||
|
@ -46,8 +46,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
|||||||
else
|
else
|
||||||
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
|
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
|
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +183,8 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// and then special windows
|
// and then special windows
|
||||||
if (pMonitor->specialWorkspaceID) for (auto& w : g_pCompositor->m_vWindows) {
|
if (pMonitor->specialWorkspaceID)
|
||||||
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!g_pCompositor->windowValidMapped(w.get()) && !w->m_bFadingOut)
|
if (!g_pCompositor->windowValidMapped(w.get()) && !w->m_bFadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -204,7 +204,6 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWor
|
|||||||
renderLayer(ls.get(), pMonitor, time);
|
renderLayer(ls.get(), pMonitor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
||||||
renderLayer(ls.get(), pMonitor, time);
|
renderLayer(ls.get(), pMonitor, time);
|
||||||
}
|
}
|
||||||
@ -245,7 +244,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||||||
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || (!pWindow->m_sSpecialRenderData.rounding);
|
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || (!pWindow->m_sSpecialRenderData.rounding);
|
||||||
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : (PWORKSPACE->m_fAlpha.fl() / 255.f));
|
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : (PWORKSPACE->m_fAlpha.fl() / 255.f));
|
||||||
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
|
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
|
||||||
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && (pWindow->m_bIsFloating ? *PNOFLOATINGBORDERS == 0 : true) && (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL);
|
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && (pWindow->m_bIsFloating ? *PNOFLOATINGBORDERS == 0 : true) &&
|
||||||
|
(!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL);
|
||||||
renderdata.rounding = ignoreAllGeometry ? 0 : pWindow->m_sAdditionalConfigData.rounding;
|
renderdata.rounding = ignoreAllGeometry ? 0 : pWindow->m_sAdditionalConfigData.rounding;
|
||||||
renderdata.blur = !ignoreAllGeometry; // if it shouldn't, it will be ignored later
|
renderdata.blur = !ignoreAllGeometry; // if it shouldn't, it will be ignored later
|
||||||
renderdata.pWindow = pWindow;
|
renderdata.pWindow = pWindow;
|
||||||
@ -292,7 +292,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||||||
|
|
||||||
// render window decorations first, if not fullscreen full
|
// render window decorations first, if not fullscreen full
|
||||||
if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_MAIN) {
|
if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_MAIN) {
|
||||||
if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL) for (auto& wd : pWindow->m_dWindowDecorations)
|
if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL)
|
||||||
|
for (auto& wd : pWindow->m_dWindowDecorations)
|
||||||
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha / 255.f, offset);
|
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha / 255.f, offset);
|
||||||
|
|
||||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);
|
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);
|
||||||
@ -522,13 +523,20 @@ void CHyprRenderer::calculateUVForWindowSurface(CWindow* pWindow, wlr_surface* p
|
|||||||
|
|
||||||
// TODO: (example: chromium) this still has a tiny "bump" at the end.
|
// TODO: (example: chromium) this still has a tiny "bump" at the end.
|
||||||
if (main) {
|
if (main) {
|
||||||
uvTL = uvTL + (Vector2D((double)geom.x / ((double)pWindow->m_uSurface.xdg->surface->current.width), (double)geom.y / ((double)pWindow->m_uSurface.xdg->surface->current.height)) * (((uvBR.x - uvTL.x) * surfaceSize.x) / surfaceSize.x));
|
uvTL = uvTL +
|
||||||
uvBR = uvBR * Vector2D((double)(geom.width + geom.x) / ((double)pWindow->m_uSurface.xdg->surface->current.width), (double)(geom.y + geom.height) / ((double)pWindow->m_uSurface.xdg->surface->current.height));
|
(Vector2D((double)geom.x / ((double)pWindow->m_uSurface.xdg->surface->current.width),
|
||||||
|
(double)geom.y / ((double)pWindow->m_uSurface.xdg->surface->current.height)) *
|
||||||
|
(((uvBR.x - uvTL.x) * surfaceSize.x) / surfaceSize.x));
|
||||||
|
uvBR = uvBR *
|
||||||
|
Vector2D((double)(geom.width + geom.x) / ((double)pWindow->m_uSurface.xdg->surface->current.width),
|
||||||
|
(double)(geom.y + geom.height) / ((double)pWindow->m_uSurface.xdg->surface->current.height));
|
||||||
}
|
}
|
||||||
} else if (main) {
|
} else if (main) {
|
||||||
// oversized windows' UV adjusting
|
// oversized windows' UV adjusting
|
||||||
uvTL = Vector2D((double)geom.x / ((double)pWindow->m_uSurface.xdg->surface->current.width), (double)geom.y / ((double)pWindow->m_uSurface.xdg->surface->current.height));
|
uvTL =
|
||||||
uvBR = Vector2D((double)(geom.width + geom.x) / ((double)pWindow->m_uSurface.xdg->surface->current.width), (double)(geom.y + geom.height) / ((double)pWindow->m_uSurface.xdg->surface->current.height));
|
Vector2D((double)geom.x / ((double)pWindow->m_uSurface.xdg->surface->current.width), (double)geom.y / ((double)pWindow->m_uSurface.xdg->surface->current.height));
|
||||||
|
uvBR = Vector2D((double)(geom.width + geom.x) / ((double)pWindow->m_uSurface.xdg->surface->current.width),
|
||||||
|
(double)(geom.y + geom.height) / ((double)pWindow->m_uSurface.xdg->surface->current.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set UV
|
// set UV
|
||||||
@ -551,9 +559,11 @@ void CHyprRenderer::calculateUVForWindowSurface(CWindow* pWindow, wlr_surface* p
|
|||||||
if (g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft == Vector2D(-1, -1))
|
if (g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft == Vector2D(-1, -1))
|
||||||
g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = Vector2D(0, 0);
|
g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = Vector2D(0, 0);
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight = Vector2D(
|
g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight =
|
||||||
g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.x * (pWindow->m_vRealSize.vec().x / ((double)geom.width / g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.x)),
|
Vector2D(g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.x *
|
||||||
g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.y * (pWindow->m_vRealSize.vec().y / ((double)geom.height / g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.y)));
|
(pWindow->m_vRealSize.vec().x / ((double)geom.width / g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.x)),
|
||||||
|
g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.y *
|
||||||
|
(pWindow->m_vRealSize.vec().y / ((double)geom.height / g_pHyprOpenGL->m_RenderData.primarySurfaceUVBottomRight.y)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
||||||
@ -582,7 +592,8 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
|
|||||||
if (PCANDIDATE->m_fAlpha.fl() != 255.f || PCANDIDATE->m_fActiveInactiveAlpha.fl() != 1.f || PWORKSPACE->m_fAlpha.fl() != 255.f)
|
if (PCANDIDATE->m_fAlpha.fl() != 255.f || PCANDIDATE->m_fActiveInactiveAlpha.fl() != 1.f || PWORKSPACE->m_fAlpha.fl() != 255.f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (PCANDIDATE->m_vRealSize.vec() != pMonitor->vecSize || PCANDIDATE->m_vRealPosition.vec() != pMonitor->vecPosition || PCANDIDATE->m_vRealPosition.isBeingAnimated() || PCANDIDATE->m_vRealSize.isBeingAnimated())
|
if (PCANDIDATE->m_vRealSize.vec() != pMonitor->vecSize || PCANDIDATE->m_vRealPosition.vec() != pMonitor->vecPosition || PCANDIDATE->m_vRealPosition.isBeingAnimated() ||
|
||||||
|
PCANDIDATE->m_vRealSize.isBeingAnimated())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty())
|
if (!pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty())
|
||||||
@ -684,21 +695,10 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWindow) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const wlr_linux_dmabuf_feedback_v1_tranche TRANCHES[] = {
|
const wlr_linux_dmabuf_feedback_v1_tranche TRANCHES[] = {
|
||||||
{
|
{.target_device = scanoutDevice, .flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT, .formats = &scanoutFormats},
|
||||||
.target_device = scanoutDevice,
|
{.target_device = rendererDevice, .formats = PRENDERERFORMATS}};
|
||||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
|
||||||
.formats = &scanoutFormats
|
|
||||||
}, {
|
|
||||||
.target_device = rendererDevice,
|
|
||||||
.formats = PRENDERERFORMATS
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const wlr_linux_dmabuf_feedback_v1 FEEDBACK = {
|
const wlr_linux_dmabuf_feedback_v1 FEEDBACK = {.main_device = rendererDevice, .tranches_len = sizeof(TRANCHES) / sizeof(TRANCHES[0]), .tranches = TRANCHES};
|
||||||
.main_device = rendererDevice,
|
|
||||||
.tranches_len = sizeof(TRANCHES) / sizeof(TRANCHES[0]),
|
|
||||||
.tranches = TRANCHES
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, g_pXWaylandManager->getWindowSurface(pWindow), &FEEDBACK)) {
|
if (!wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, g_pXWaylandManager->getWindowSurface(pWindow), &FEEDBACK)) {
|
||||||
Debug::log(ERR, "Error in scanout mode setting: wlr_linux_dmabuf_v1_set_surface_feedback returned false.");
|
Debug::log(ERR, "Error in scanout mode setting: wlr_linux_dmabuf_v1_set_surface_feedback returned false.");
|
||||||
@ -730,9 +730,11 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool
|
|||||||
wlr_output_enable(OUTPUT, head->state.enabled);
|
wlr_output_enable(OUTPUT, head->state.enabled);
|
||||||
|
|
||||||
if (head->state.mode)
|
if (head->state.mode)
|
||||||
commandForCfg += std::to_string(head->state.mode->width) + "x" + std::to_string(head->state.mode->height) + "@" + std::to_string(head->state.mode->refresh / 1000.f) + ",";
|
commandForCfg +=
|
||||||
|
std::to_string(head->state.mode->width) + "x" + std::to_string(head->state.mode->height) + "@" + std::to_string(head->state.mode->refresh / 1000.f) + ",";
|
||||||
else
|
else
|
||||||
commandForCfg += std::to_string(head->state.custom_mode.width) + "x" + std::to_string(head->state.custom_mode.height) + "@" + std::to_string(head->state.custom_mode.refresh / 1000.f) + ",";
|
commandForCfg += std::to_string(head->state.custom_mode.width) + "x" + std::to_string(head->state.custom_mode.height) + "@" +
|
||||||
|
std::to_string(head->state.custom_mode.refresh / 1000.f) + ",";
|
||||||
|
|
||||||
commandForCfg += std::to_string(head->state.x) + "x" + std::to_string(head->state.y) + "," + std::to_string(head->state.scale);
|
commandForCfg += std::to_string(head->state.x) + "x" + std::to_string(head->state.y) + "," + std::to_string(head->state.scale);
|
||||||
|
|
||||||
@ -781,10 +783,7 @@ void apply_exclusive(struct wlr_box* usable_area, uint32_t anchor, int32_t exclu
|
|||||||
// Top
|
// Top
|
||||||
{
|
{
|
||||||
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP,
|
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP,
|
||||||
.anchor_triplet =
|
.anchor_triplet = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP,
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP,
|
|
||||||
.positive_axis = &usable_area->y,
|
.positive_axis = &usable_area->y,
|
||||||
.negative_axis = &usable_area->height,
|
.negative_axis = &usable_area->height,
|
||||||
.margin = margin_top,
|
.margin = margin_top,
|
||||||
@ -792,10 +791,7 @@ void apply_exclusive(struct wlr_box* usable_area, uint32_t anchor, int32_t exclu
|
|||||||
// Bottom
|
// Bottom
|
||||||
{
|
{
|
||||||
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
||||||
.anchor_triplet =
|
.anchor_triplet = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
|
||||||
.positive_axis = NULL,
|
.positive_axis = NULL,
|
||||||
.negative_axis = &usable_area->height,
|
.negative_axis = &usable_area->height,
|
||||||
.margin = margin_bottom,
|
.margin = margin_bottom,
|
||||||
@ -803,10 +799,7 @@ void apply_exclusive(struct wlr_box* usable_area, uint32_t anchor, int32_t exclu
|
|||||||
// Left
|
// Left
|
||||||
{
|
{
|
||||||
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT,
|
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT,
|
||||||
.anchor_triplet =
|
.anchor_triplet = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
|
||||||
.positive_axis = &usable_area->x,
|
.positive_axis = &usable_area->x,
|
||||||
.negative_axis = &usable_area->width,
|
.negative_axis = &usable_area->width,
|
||||||
.margin = margin_left,
|
.margin = margin_left,
|
||||||
@ -814,10 +807,7 @@ void apply_exclusive(struct wlr_box* usable_area, uint32_t anchor, int32_t exclu
|
|||||||
// Right
|
// Right
|
||||||
{
|
{
|
||||||
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT,
|
.singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT,
|
||||||
.anchor_triplet =
|
.anchor_triplet = ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
|
|
||||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
|
|
||||||
.positive_axis = NULL,
|
.positive_axis = NULL,
|
||||||
.negative_axis = &usable_area->width,
|
.negative_axis = &usable_area->width,
|
||||||
.margin = margin_right,
|
.margin = margin_right,
|
||||||
@ -856,9 +846,7 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
|
|||||||
bounds = *usableArea;
|
bounds = *usableArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_box box = {
|
wlr_box box = {.width = PSTATE->desired_width, .height = PSTATE->desired_height};
|
||||||
.width = PSTATE->desired_width,
|
|
||||||
.height = PSTATE->desired_height};
|
|
||||||
// Horizontal axis
|
// Horizontal axis
|
||||||
const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
||||||
if (box.width == 0) {
|
if (box.width == 0) {
|
||||||
@ -888,8 +876,7 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
|
|||||||
// Margin
|
// Margin
|
||||||
if (box.width == 0) {
|
if (box.width == 0) {
|
||||||
box.x += PSTATE->margin.left;
|
box.x += PSTATE->margin.left;
|
||||||
box.width = bounds.width -
|
box.width = bounds.width - (PSTATE->margin.left + PSTATE->margin.right);
|
||||||
(PSTATE->margin.left + PSTATE->margin.right);
|
|
||||||
} else if ((PSTATE->anchor & both_horiz) == both_horiz) {
|
} else if ((PSTATE->anchor & both_horiz) == both_horiz) {
|
||||||
// don't apply margins
|
// don't apply margins
|
||||||
} else if ((PSTATE->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) {
|
} else if ((PSTATE->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) {
|
||||||
@ -899,8 +886,7 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
|
|||||||
}
|
}
|
||||||
if (box.height == 0) {
|
if (box.height == 0) {
|
||||||
box.y += PSTATE->margin.top;
|
box.y += PSTATE->margin.top;
|
||||||
box.height = bounds.height -
|
box.height = bounds.height - (PSTATE->margin.top + PSTATE->margin.bottom);
|
||||||
(PSTATE->margin.top + PSTATE->margin.bottom);
|
|
||||||
} else if ((PSTATE->anchor & both_vert) == both_vert) {
|
} else if ((PSTATE->anchor & both_vert) == both_vert) {
|
||||||
// don't apply margins
|
// don't apply margins
|
||||||
} else if ((PSTATE->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) {
|
} else if ((PSTATE->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) {
|
||||||
@ -919,7 +905,8 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
|
|||||||
|
|
||||||
wlr_layer_surface_v1_configure(ls->layerSurface, box.width, box.height);
|
wlr_layer_surface_v1_configure(ls->layerSurface, box.width, box.height);
|
||||||
|
|
||||||
Debug::log(LOG, "LayerSurface %x arranged: x: %i y: %i w: %i h: %i with margins: t: %i l: %i r: %i b: %i", &ls, box.x, box.y, box.width, box.height, PSTATE->margin.top, PSTATE->margin.left, PSTATE->margin.right, PSTATE->margin.bottom);
|
Debug::log(LOG, "LayerSurface %x arranged: x: %i y: %i w: %i h: %i with margins: t: %i l: %i r: %i b: %i", &ls, box.x, box.y, box.width, box.height, PSTATE->margin.top,
|
||||||
|
PSTATE->margin.left, PSTATE->margin.right, PSTATE->margin.bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -960,7 +947,8 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
|
|||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitor);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitor);
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor %s layers arranged: reserved: %f %f %f %f", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y, PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
Debug::log(LOG, "Monitor %s layers arranged: reserved: %f %f %f %f", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y,
|
||||||
|
PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
||||||
@ -1004,7 +992,8 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
|||||||
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
|
||||||
|
|
||||||
if (*PLOGDAMAGE)
|
if (*PLOGDAMAGE)
|
||||||
Debug::log(LOG, "Damage: Surface (extents): xy: %d, %d wh: %d, %d", damageBox.extents.x1, damageBox.extents.y1, damageBox.extents.x2 - damageBox.extents.x1, damageBox.extents.y2 - damageBox.extents.y1);
|
Debug::log(LOG, "Damage: Surface (extents): xy: %d, %d wh: %d, %d", damageBox.extents.x1, damageBox.extents.y1, damageBox.extents.x2 - damageBox.extents.x1,
|
||||||
|
damageBox.extents.y2 - damageBox.extents.y1);
|
||||||
|
|
||||||
pixman_region32_fini(&damageBox);
|
pixman_region32_fini(&damageBox);
|
||||||
}
|
}
|
||||||
@ -1094,7 +1083,8 @@ void CHyprRenderer::renderDragIcon(CMonitor* pMonitor, timespec* time) {
|
|||||||
|
|
||||||
wlr_surface_for_each_surface(g_pInputManager->m_sDrag.dragIcon->surface, renderSurface, &renderdata);
|
wlr_surface_for_each_surface(g_pInputManager->m_sDrag.dragIcon->surface, renderSurface, &renderdata);
|
||||||
|
|
||||||
wlr_box box = {g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4, g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4};
|
wlr_box box = {g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4,
|
||||||
|
g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4};
|
||||||
g_pHyprRenderer->damageBox(&box);
|
g_pHyprRenderer->damageBox(&box);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1128,14 +1118,11 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the rule isn't already applied
|
// Check if the rule isn't already applied
|
||||||
if (!force
|
if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1) &&
|
||||||
&& DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1)
|
DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale &&
|
||||||
&& DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1)
|
((DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1)) ||
|
||||||
&& DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1)
|
pMonitorRule->offset == Vector2D(-1, -1)) &&
|
||||||
&& pMonitor->scale == pMonitorRule->scale
|
pMonitor->transform == pMonitorRule->transform && pMonitorRule->enable10bit == pMonitor->enabled10bit) {
|
||||||
&& ((DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1)) || pMonitorRule->offset == Vector2D(-1, -1))
|
|
||||||
&& pMonitor->transform == pMonitorRule->transform
|
|
||||||
&& pMonitorRule->enable10bit == pMonitor->enabled10bit) {
|
|
||||||
|
|
||||||
Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
|
Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
|
||||||
return true;
|
return true;
|
||||||
@ -1161,19 +1148,18 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
|
|
||||||
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
||||||
// if delta of refresh rate, w and h chosen and mode is < 1 we accept it
|
// if delta of refresh rate, w and h chosen and mode is < 1 we accept it
|
||||||
if (DELTALESSTHAN(mode->width, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(mode->height, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(mode->refresh / 1000.f, pMonitorRule->refreshRate, 1)) {
|
if (DELTALESSTHAN(mode->width, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(mode->height, pMonitorRule->resolution.y, 1) &&
|
||||||
|
DELTALESSTHAN(mode->refresh / 1000.f, pMonitorRule->refreshRate, 1)) {
|
||||||
wlr_output_set_mode(pMonitor->output, mode);
|
wlr_output_set_mode(pMonitor->output, mode);
|
||||||
|
|
||||||
if (!wlr_output_test(pMonitor->output)) {
|
if (!wlr_output_test(pMonitor->output)) {
|
||||||
Debug::log(LOG, "Monitor %s: REJECTED available mode: %ix%i@%2f!",
|
Debug::log(LOG, "Monitor %s: REJECTED available mode: %ix%i@%2f!", pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
|
||||||
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
|
(float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
|
||||||
mode->width, mode->height, mode->refresh / 1000.f);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor %s: requested %ix%i@%2f, found available mode: %ix%i@%imHz, applying.",
|
Debug::log(LOG, "Monitor %s: requested %ix%i@%2f, found available mode: %ix%i@%imHz, applying.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
|
||||||
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
|
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
|
||||||
mode->width, mode->height, mode->refresh);
|
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
@ -1195,22 +1181,23 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
||||||
|
|
||||||
if (!PREFERREDMODE) {
|
if (!PREFERREDMODE) {
|
||||||
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f",
|
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f", (int)pMonitorRule->resolution.x,
|
||||||
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferred is valid
|
// Preferred is valid
|
||||||
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
|
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
|
||||||
|
|
||||||
Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f",
|
Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f", pMonitor->output->name,
|
||||||
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
|
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
|
||||||
PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
PREFERREDMODE->refresh / 1000.f);
|
||||||
|
|
||||||
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
||||||
} else {
|
} else {
|
||||||
Debug::log(LOG, "Set a custom mode %ix%i@%2f (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
Debug::log(LOG, "Set a custom mode %ix%i@%2f (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
|
||||||
|
(float)pMonitorRule->refreshRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1224,19 +1211,23 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
||||||
|
|
||||||
if (!PREFERREDMODE) {
|
if (!PREFERREDMODE) {
|
||||||
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f", (int)pMonitorRule->resolution.x,
|
||||||
|
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferred is valid
|
// Preferred is valid
|
||||||
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
|
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
|
||||||
|
|
||||||
Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f", pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f", pMonitor->output->name,
|
||||||
|
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
|
||||||
|
PREFERREDMODE->refresh / 1000.f);
|
||||||
|
|
||||||
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
||||||
} else {
|
} else {
|
||||||
Debug::log(LOG, "Set a custom mode %ix%i@%2f (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
Debug::log(LOG, "Set a custom mode %ix%i@%2f (mode not found in monitor modes)", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
|
||||||
|
(float)pMonitorRule->refreshRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (pMonitorRule->resolution != Vector2D()) {
|
} else if (pMonitorRule->resolution != Vector2D()) {
|
||||||
@ -1262,7 +1253,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
||||||
if( ( mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= ( currentRefresh - 1000.f ) ) || ( mode->width > currentWidth && mode->height > currentHeight ) ) {
|
if ((mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= (currentRefresh - 1000.f)) ||
|
||||||
|
(mode->width > currentWidth && mode->height > currentHeight)) {
|
||||||
wlr_output_set_mode(pMonitor->output, mode);
|
wlr_output_set_mode(pMonitor->output, mode);
|
||||||
if (wlr_output_test(pMonitor->output)) {
|
if (wlr_output_test(pMonitor->output)) {
|
||||||
currentWidth = mode->width;
|
currentWidth = mode->width;
|
||||||
@ -1275,31 +1267,29 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
Debug::log(LOG, "Monitor %s: REJECTED mode: %ix%i@%2f! Falling back to preferred.",
|
Debug::log(LOG, "Monitor %s: REJECTED mode: %ix%i@%2f! Falling back to preferred.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
|
||||||
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
|
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
|
||||||
mode->width, mode->height, mode->refresh / 1000.f);
|
|
||||||
|
|
||||||
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
||||||
|
|
||||||
if (!PREFERREDMODE) {
|
if (!PREFERREDMODE) {
|
||||||
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f",
|
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE, and an INVALID one was requested: %ix%i@%2f", (int)pMonitorRule->resolution.x,
|
||||||
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferred is valid
|
// Preferred is valid
|
||||||
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
|
wlr_output_set_mode(pMonitor->output, PREFERREDMODE);
|
||||||
|
|
||||||
Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f",
|
Debug::log(ERR, "Monitor %s got an invalid requested mode: %ix%i@%2f, using the preferred one instead: %ix%i@%2f", pMonitor->output->name,
|
||||||
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
|
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height,
|
||||||
PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
PREFERREDMODE->refresh / 1000.f);
|
||||||
|
|
||||||
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor %s: Applying highest mode %ix%i@%2f.",
|
Debug::log(LOG, "Monitor %s: Applying highest mode %ix%i@%2f.", pMonitor->output->name, (int)currentWidth, (int)currentHeight, (int)currentRefresh / 1000.f,
|
||||||
pMonitor->output->name, (int)currentWidth, (int)currentHeight, (int)currentRefresh / 1000.f,
|
|
||||||
mode->width, mode->height, mode->refresh / 1000.f);
|
mode->width, mode->height, mode->refresh / 1000.f);
|
||||||
|
|
||||||
pMonitor->refreshRate = currentRefresh / 1000.f;
|
pMonitor->refreshRate = currentRefresh / 1000.f;
|
||||||
@ -1310,8 +1300,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
||||||
|
|
||||||
if (!PREFERREDMODE) {
|
if (!PREFERREDMODE) {
|
||||||
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE",
|
Debug::log(ERR, "Monitor %s has NO PREFERRED MODE", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
||||||
(int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate);
|
|
||||||
|
|
||||||
if (!wl_list_empty(&pMonitor->output->modes)) {
|
if (!wl_list_empty(&pMonitor->output->modes)) {
|
||||||
wlr_output_mode* mode;
|
wlr_output_mode* mode;
|
||||||
@ -1320,15 +1309,13 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
wlr_output_set_mode(pMonitor->output, mode);
|
wlr_output_set_mode(pMonitor->output, mode);
|
||||||
|
|
||||||
if (!wlr_output_test(pMonitor->output)) {
|
if (!wlr_output_test(pMonitor->output)) {
|
||||||
Debug::log(LOG, "Monitor %s: REJECTED available mode: %ix%i@%2f!",
|
Debug::log(LOG, "Monitor %s: REJECTED available mode: %ix%i@%2f!", pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y,
|
||||||
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
|
(float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
|
||||||
mode->width, mode->height, mode->refresh / 1000.f);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor %s: requested %ix%i@%2f, found available mode: %ix%i@%imHz, applying.",
|
Debug::log(LOG, "Monitor %s: requested %ix%i@%2f, found available mode: %ix%i@%imHz, applying.", pMonitor->output->name, (int)pMonitorRule->resolution.x,
|
||||||
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
|
(int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
|
||||||
mode->width, mode->height, mode->refresh);
|
|
||||||
|
|
||||||
pMonitor->refreshRate = mode->refresh / 1000.f;
|
pMonitor->refreshRate = mode->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(mode->width, mode->height);
|
pMonitor->vecSize = Vector2D(mode->width, mode->height);
|
||||||
@ -1387,7 +1374,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
|
|
||||||
if (pMonitor->createdByUser) {
|
if (pMonitor->createdByUser) {
|
||||||
wlr_box transformedBox = {0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y};
|
wlr_box transformedBox = {0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y};
|
||||||
wlr_box_transform(&transformedBox, &transformedBox, wlr_output_transform_invert(pMonitor->output->transform), (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
|
wlr_box_transform(&transformedBox, &transformedBox, wlr_output_transform_invert(pMonitor->output->transform), (int)pMonitor->vecTransformedSize.x,
|
||||||
|
(int)pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
pMonitor->vecPixelSize = Vector2D(transformedBox.width, transformedBox.height);
|
pMonitor->vecPixelSize = Vector2D(transformedBox.width, transformedBox.height);
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,16 @@
|
|||||||
struct SMonitorRule;
|
struct SMonitorRule;
|
||||||
|
|
||||||
// TODO: add fuller damage tracking for updating only parts of a window
|
// TODO: add fuller damage tracking for updating only parts of a window
|
||||||
enum DAMAGETRACKINGMODES {
|
enum DAMAGETRACKINGMODES
|
||||||
|
{
|
||||||
DAMAGE_TRACKING_INVALID = -1,
|
DAMAGE_TRACKING_INVALID = -1,
|
||||||
DAMAGE_TRACKING_NONE = 0,
|
DAMAGE_TRACKING_NONE = 0,
|
||||||
DAMAGE_TRACKING_MONITOR,
|
DAMAGE_TRACKING_MONITOR,
|
||||||
DAMAGE_TRACKING_FULL
|
DAMAGE_TRACKING_FULL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eRenderPassMode {
|
enum eRenderPassMode
|
||||||
|
{
|
||||||
RENDER_PASS_ALL = 0,
|
RENDER_PASS_ALL = 0,
|
||||||
RENDER_PASS_MAIN,
|
RENDER_PASS_MAIN,
|
||||||
RENDER_PASS_POPUP
|
RENDER_PASS_POPUP
|
||||||
@ -27,7 +29,6 @@ class CToplevelExportProtocolManager;
|
|||||||
|
|
||||||
class CHyprRenderer {
|
class CHyprRenderer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void renderAllClientsForMonitor(const int&, timespec*);
|
void renderAllClientsForMonitor(const int&, timespec*);
|
||||||
void outputMgrApplyTest(wlr_output_configuration_v1*, bool);
|
void outputMgrApplyTest(wlr_output_configuration_v1*, bool);
|
||||||
void arrangeLayersForMonitor(const int&);
|
void arrangeLayersForMonitor(const int&);
|
||||||
@ -64,7 +65,6 @@ private:
|
|||||||
|
|
||||||
bool m_bHasARenderedCursor = true;
|
bool m_bHasARenderedCursor = true;
|
||||||
|
|
||||||
|
|
||||||
friend class CHyprOpenGLImpl;
|
friend class CHyprOpenGLImpl;
|
||||||
friend class CToplevelExportProtocolManager;
|
friend class CToplevelExportProtocolManager;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
|
|
||||||
enum TEXTURETYPE {
|
enum TEXTURETYPE
|
||||||
|
{
|
||||||
TEXTURE_INVALID, // Invalid
|
TEXTURE_INVALID, // Invalid
|
||||||
TEXTURE_RGBA, // 4 channels
|
TEXTURE_RGBA, // 4 channels
|
||||||
TEXTURE_RGBX, // discard A
|
TEXTURE_RGBX, // discard A
|
||||||
|
@ -29,7 +29,8 @@ void CHyprDropShadowDecoration::damageEntire() {
|
|||||||
if (*PSHADOWS != 1)
|
if (*PSHADOWS != 1)
|
||||||
return; // disabled
|
return; // disabled
|
||||||
|
|
||||||
wlr_box dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
|
wlr_box dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
|
||||||
|
m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
|
||||||
g_pHyprRenderer->damageBox(&dm);
|
g_pHyprRenderer->damageBox(&dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,11 +73,11 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
|
|||||||
if (*PSHADOWS != 1)
|
if (*PSHADOWS != 1)
|
||||||
return; // disabled
|
return; // disabled
|
||||||
|
|
||||||
const auto ROUNDING = !m_pWindow->m_sSpecialRenderData.rounding ? 0 : (m_pWindow->m_sAdditionalConfigData.rounding == -1 ? *PROUNDING : m_pWindow->m_sAdditionalConfigData.rounding);
|
const auto ROUNDING =
|
||||||
|
!m_pWindow->m_sSpecialRenderData.rounding ? 0 : (m_pWindow->m_sAdditionalConfigData.rounding == -1 ? *PROUNDING : m_pWindow->m_sAdditionalConfigData.rounding);
|
||||||
|
|
||||||
// draw the shadow
|
// draw the shadow
|
||||||
wlr_box fullBox = { m_vLastWindowPos.x - *PSHADOWSIZE, m_vLastWindowPos.y - *PSHADOWSIZE,
|
wlr_box fullBox = {m_vLastWindowPos.x - *PSHADOWSIZE, m_vLastWindowPos.y - *PSHADOWSIZE, m_vLastWindowSize.x + 2.0 * *PSHADOWSIZE, m_vLastWindowSize.y + 2.0 * *PSHADOWSIZE};
|
||||||
m_vLastWindowSize.x + 2.0 * *PSHADOWSIZE, m_vLastWindowSize.y + 2.0 * *PSHADOWSIZE };
|
|
||||||
|
|
||||||
fullBox.x -= pMonitor->vecPosition.x;
|
fullBox.x -= pMonitor->vecPosition.x;
|
||||||
fullBox.y -= pMonitor->vecPosition.y;
|
fullBox.y -= pMonitor->vecPosition.y;
|
||||||
@ -104,8 +105,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
|
|||||||
fullBox.y += ((m_vLastWindowSize.y + 2.0 * *PSHADOWSIZE) - NEWSIZE.y) / 2.0;
|
fullBox.y += ((m_vLastWindowSize.y + 2.0 * *PSHADOWSIZE) - NEWSIZE.y) / 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_seExtents = { { m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2,
|
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
|
||||||
m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
|
|
||||||
{fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
|
{fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
|
||||||
fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
|
fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
|
||||||
|
|
||||||
|
@ -5,9 +5,7 @@ CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) {
|
|||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {
|
CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SWindowDecorationExtents CHyprGroupBarDecoration::getWindowDecorationExtents() {
|
SWindowDecorationExtents CHyprGroupBarDecoration::getWindowDecorationExtents() {
|
||||||
return m_seExtents;
|
return m_seExtents;
|
||||||
@ -59,7 +57,8 @@ void CHyprGroupBarDecoration::updateWindow(CWindow* pWindow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CHyprGroupBarDecoration::damageEntire() {
|
void CHyprGroupBarDecoration::damageEntire() {
|
||||||
wlr_box dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, m_seExtents.topLeft.y};
|
wlr_box dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
|
||||||
|
m_seExtents.topLeft.y};
|
||||||
g_pHyprRenderer->damageBox(&dm);
|
g_pHyprRenderer->damageBox(&dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
#include "../../Window.hpp"
|
#include "../../Window.hpp"
|
||||||
|
|
||||||
IHyprWindowDecoration::~IHyprWindowDecoration() {
|
IHyprWindowDecoration::~IHyprWindowDecoration() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
#include "../../defines.hpp"
|
#include "../../defines.hpp"
|
||||||
|
|
||||||
enum eDecorationType {
|
enum eDecorationType
|
||||||
|
{
|
||||||
DECORATION_NONE = -1,
|
DECORATION_NONE = -1,
|
||||||
DECORATION_GROUPBAR,
|
DECORATION_GROUPBAR,
|
||||||
DECORATION_SHADOW
|
DECORATION_SHADOW
|
||||||
|
Loading…
Reference in New Issue
Block a user