mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 01:05:59 +01:00
merge upstream
This commit is contained in:
commit
e9a4a69fd8
13 changed files with 142 additions and 48 deletions
1
.github/workflows/stale.yml
vendored
1
.github/workflows/stale.yml
vendored
|
@ -25,3 +25,4 @@ jobs:
|
||||||
stale-issue-label: 'stale'
|
stale-issue-label: 'stale'
|
||||||
stale-pr-label: 'stale'
|
stale-pr-label: 'stale'
|
||||||
operations-per-run: 40
|
operations-per-run: 40
|
||||||
|
days-before-close: -1
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -42,7 +42,7 @@ install:
|
||||||
chmod 755 ${PREFIX}/bin/Hyprland
|
chmod 755 ${PREFIX}/bin/Hyprland
|
||||||
chmod 755 ${PREFIX}/bin/hyprctl
|
chmod 755 ${PREFIX}/bin/hyprctl
|
||||||
chmod 755 ${PREFIX}/bin/hyprpm
|
chmod 755 ${PREFIX}/bin/hyprpm
|
||||||
ln -s -r -f ${PREFIX}/bin/Hyprland ${PREFIX}/bin/hyprland
|
cd ${PREFIX}/bin && ln -sf Hyprland hyprland
|
||||||
if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi
|
if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi
|
||||||
mkdir -p ${PREFIX}/share/hyprland
|
mkdir -p ${PREFIX}/share/hyprland
|
||||||
cp ./assets/wall_* ${PREFIX}/share/hyprland
|
cp ./assets/wall_* ${PREFIX}/share/hyprland
|
||||||
|
|
47
flake.lock
47
flake.lock
|
@ -23,13 +23,47 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"hyprlang": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1704287638,
|
||||||
|
"narHash": "sha256-TuRXJGwtK440AXQNl5eiqmQqY4LZ/9+z/R7xC0ie3iA=",
|
||||||
|
"owner": "hyprwm",
|
||||||
|
"repo": "hyprlang",
|
||||||
|
"rev": "6624f2bb66d4d27975766e81f77174adbe58ec97",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hyprwm",
|
||||||
|
"repo": "hyprlang",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703438236,
|
"lastModified": 1704194953,
|
||||||
"narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=",
|
"narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b",
|
"rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1702645756,
|
||||||
|
"narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -87,6 +121,7 @@
|
||||||
"hyprland-protocols": [
|
"hyprland-protocols": [
|
||||||
"hyprland-protocols"
|
"hyprland-protocols"
|
||||||
],
|
],
|
||||||
|
"hyprlang": "hyprlang",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
|
@ -95,11 +130,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703514399,
|
"lastModified": 1704400467,
|
||||||
"narHash": "sha256-VRr5Xc4S/VPr/gU3fiOD3vSIL2+GJ+LUrmFTWTwnTz4=",
|
"narHash": "sha256-IsEAKBCorRlN53FwFAMbyGLRsPVu/ZrWEJtCwykPds8=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "0a318a7a217a6402b0b705837cd5b50b0e94b31b",
|
"rev": "1c802128f6cc3db29a8ef01552b1a22f894eeefd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -47,7 +47,8 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) {
|
||||||
|
|
||||||
DATA.emplace(p.name, toml::table{
|
DATA.emplace(p.name, toml::table{
|
||||||
{"filename", p.name + ".so"},
|
{"filename", p.name + ".so"},
|
||||||
{"enabled", p.enabled}
|
{"enabled", p.enabled},
|
||||||
|
{"failed", p.failed}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
@ -172,9 +173,10 @@ std::vector<SPluginRepository> DataState::getAllRepositories() {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto ENABLED = STATE[key]["enabled"].value_or(false);
|
const auto ENABLED = STATE[key]["enabled"].value_or(false);
|
||||||
|
const auto FAILED = STATE[key]["failed"].value_or(false);
|
||||||
const auto FILENAME = STATE[key]["filename"].value_or("");
|
const auto FILENAME = STATE[key]["filename"].value_or("");
|
||||||
|
|
||||||
repo.plugins.push_back(SPlugin{std::string{key.str()}, FILENAME, ENABLED});
|
repo.plugins.push_back(SPlugin{std::string{key.str()}, FILENAME, ENABLED, FAILED});
|
||||||
}
|
}
|
||||||
|
|
||||||
repos.push_back(repo);
|
repos.push_back(repo);
|
||||||
|
@ -201,6 +203,11 @@ bool DataState::setPluginEnabled(const std::string& name, bool enabled) {
|
||||||
if (key.str() != name)
|
if (key.str() != name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
const auto FAILED = STATE[key]["failed"].value_or(false);
|
||||||
|
|
||||||
|
if (FAILED)
|
||||||
|
return false;
|
||||||
|
|
||||||
(*STATE[key].as_table()).insert_or_assign("enabled", enabled);
|
(*STATE[key].as_table()).insert_or_assign("enabled", enabled);
|
||||||
|
|
||||||
std::ofstream state(entry.path().string() + "/state.toml", std::ios::trunc);
|
std::ofstream state(entry.path().string() + "/state.toml", std::ios::trunc);
|
||||||
|
|
|
@ -19,6 +19,7 @@ class CManifest {
|
||||||
std::vector<std::string> authors;
|
std::vector<std::string> authors;
|
||||||
std::vector<std::string> buildSteps;
|
std::vector<std::string> buildSteps;
|
||||||
std::string output;
|
std::string output;
|
||||||
|
bool failed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
struct SPlugin {
|
struct SPlugin {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
bool enabled;
|
bool enabled = false;
|
||||||
|
bool failed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SPluginRepository {
|
struct SPluginRepository {
|
||||||
|
|
|
@ -195,12 +195,14 @@ bool CPluginManager::addNewPluginRepo(const std::string& url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!std::filesystem::exists("/tmp/hyprpm/new/" + p.output)) {
|
if (!std::filesystem::exists("/tmp/hyprpm/new/" + p.output)) {
|
||||||
std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Plugin " << p.name << " failed to build.\n";
|
progress.printMessageAbove(std::string{Colors::RED} + "✖" + Colors::RESET + " Plugin " + p.name + " failed to build.\n");
|
||||||
|
|
||||||
if (m_bVerbose)
|
if (m_bVerbose)
|
||||||
std::cout << Colors::BLUE << "[v] " << Colors::RESET << "shell returned: " << out << "\n";
|
std::cout << Colors::BLUE << "[v] " << Colors::RESET << "shell returned: " << out << "\n";
|
||||||
|
|
||||||
return false;
|
p.failed = true;
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " built " + p.name + " into " + p.output);
|
progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " built " + p.name + " into " + p.output);
|
||||||
|
@ -220,7 +222,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url) {
|
||||||
repo.url = url;
|
repo.url = url;
|
||||||
repo.hash = repohash;
|
repo.hash = repohash;
|
||||||
for (auto& p : pManifest->m_vPlugins) {
|
for (auto& p : pManifest->m_vPlugins) {
|
||||||
repo.plugins.push_back(SPlugin{p.name, "/tmp/hyprpm/new/" + p.output, false});
|
repo.plugins.push_back(SPlugin{p.name, "/tmp/hyprpm/new/" + p.output, false, p.failed});
|
||||||
}
|
}
|
||||||
DataState::addNewPluginRepo(repo);
|
DataState::addNewPluginRepo(repo);
|
||||||
|
|
||||||
|
@ -696,8 +698,13 @@ void CPluginManager::listAllPlugins() {
|
||||||
std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
|
std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
|
||||||
|
|
||||||
for (auto& p : r.plugins) {
|
for (auto& p : r.plugins) {
|
||||||
std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name + "\n └─ enabled: " << (p.enabled ? Colors::GREEN : Colors::RED) << (p.enabled ? "true" : "false")
|
|
||||||
<< Colors::RESET << "\n";
|
std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name;
|
||||||
|
|
||||||
|
if (!p.failed)
|
||||||
|
std::cout << "\n └─ enabled: " << (p.enabled ? Colors::GREEN : Colors::RED) << (p.enabled ? "true" : "false") << Colors::RESET << "\n";
|
||||||
|
else
|
||||||
|
std::cout << "\n └─ enabled: " << Colors::RED << "Plugin failed to build" << Colors::RESET << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -928,12 +928,13 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
if (pWindow->m_bPinned)
|
if (pWindow->m_bPinned)
|
||||||
pWindow->m_iWorkspaceID = m_pLastMonitor->activeWorkspace;
|
pWindow->m_iWorkspaceID = m_pLastMonitor->activeWorkspace;
|
||||||
|
|
||||||
|
const auto PMONITOR = getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
|
||||||
if (!isWorkspaceVisible(pWindow->m_iWorkspaceID)) {
|
if (!isWorkspaceVisible(pWindow->m_iWorkspaceID)) {
|
||||||
|
const auto PWORKSPACE = getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||||
// This is to fix incorrect feedback on the focus history.
|
// This is to fix incorrect feedback on the focus history.
|
||||||
const auto PWORKSPACE = getWorkspaceByID(pWindow->m_iWorkspaceID);
|
|
||||||
PWORKSPACE->m_pLastFocusedWindow = pWindow;
|
PWORKSPACE->m_pLastFocusedWindow = pWindow;
|
||||||
PWORKSPACE->rememberPrevWorkspace(getWorkspaceByID(m_pLastMonitor->activeWorkspace));
|
PWORKSPACE->rememberPrevWorkspace(getWorkspaceByID(m_pLastMonitor->activeWorkspace));
|
||||||
const auto PMONITOR = getMonitorFromID(PWORKSPACE->m_iMonitorID);
|
|
||||||
PMONITOR->changeWorkspace(PWORKSPACE, false, true);
|
PMONITOR->changeWorkspace(PWORKSPACE, false, true);
|
||||||
// changeworkspace already calls focusWindow
|
// changeworkspace already calls focusWindow
|
||||||
return;
|
return;
|
||||||
|
@ -942,6 +943,9 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
const auto PLASTWINDOW = m_pLastWindow;
|
const auto PLASTWINDOW = m_pLastWindow;
|
||||||
m_pLastWindow = pWindow;
|
m_pLastWindow = pWindow;
|
||||||
|
|
||||||
|
if (PMONITOR->specialWorkspaceID && PMONITOR->specialWorkspaceID != pWindow->m_iWorkspaceID)
|
||||||
|
PMONITOR->setSpecialWorkspace(nullptr);
|
||||||
|
|
||||||
// we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window
|
// we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window
|
||||||
if (windowValidMapped(PLASTWINDOW)) {
|
if (windowValidMapped(PLASTWINDOW)) {
|
||||||
PLASTWINDOW->updateDynamicRules();
|
PLASTWINDOW->updateDynamicRules();
|
||||||
|
@ -1015,10 +1019,8 @@ 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 == pWindowOwner->m_pWLSurface.wlr()))
|
if (m_sSeat.seat->keyboard_state.focused_surface == pSurface || (pWindowOwner && m_sSeat.seat->keyboard_state.focused_surface == pWindowOwner->m_pWLSurface.wlr()))
|
||||||
return; // Don't focus when already focused on this.
|
return; // Don't focus when already focused on this.
|
||||||
|
|
||||||
if (g_pSessionLockManager->isSessionLocked()) {
|
if (g_pSessionLockManager->isSessionLocked() && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
|
||||||
wlr_seat_keyboard_clear_focus(m_sSeat.seat);
|
return;
|
||||||
m_pLastFocus = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unfocus last surface if should
|
// Unfocus last surface if should
|
||||||
if (m_pLastFocus && !pWindowOwner)
|
if (m_pLastFocus && !pWindowOwner)
|
||||||
|
|
|
@ -73,6 +73,8 @@ class CBox {
|
||||||
double height;
|
double height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
double rot = 0; /* rad, ccw */
|
||||||
|
|
||||||
//
|
//
|
||||||
bool operator==(const CBox& rhs) const {
|
bool operator==(const CBox& rhs) const {
|
||||||
return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h;
|
return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h;
|
||||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoreSudo && Init::isSudo()) {
|
if (!ignoreSudo && Init::isSudo()) {
|
||||||
std::cerr << "[ ERROR ] Hyprland was launched with superuser priveleges, but the privileges check is not omitted.\n";
|
std::cerr << "[ ERROR ] Hyprland was launched with superuser privileges, but the privileges check is not omitted.\n";
|
||||||
std::cerr << " Hint: Use the --i-am-really-stupid flag to omit that check.\n";
|
std::cerr << " Hint: Use the --i-am-really-stupid flag to omit that check.\n";
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -232,7 +232,8 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, CRegion* pDamage, CFramebuffer*
|
||||||
const auto PRBO = g_pHyprRenderer->getCurrentRBO();
|
const auto PRBO = g_pHyprRenderer->getCurrentRBO();
|
||||||
const bool FBPROPERSIZE = fb && fb->m_vSize == pMonitor->vecPixelSize;
|
const bool FBPROPERSIZE = fb && fb->m_vSize == pMonitor->vecPixelSize;
|
||||||
|
|
||||||
if (!FBPROPERSIZE || m_sFinalScreenShader.program > 0 || (PRBO && pMonitor->vecPixelSize != PRBO->getFB()->m_vSize) || passRequiresIntrospection(pMonitor)) {
|
if (m_RenderData.forceIntrospection || !FBPROPERSIZE || m_sFinalScreenShader.program > 0 || (PRBO && pMonitor->vecPixelSize != PRBO->getFB()->m_vSize) ||
|
||||||
|
passRequiresIntrospection(pMonitor)) {
|
||||||
// we have to offload
|
// we have to offload
|
||||||
// bind the offload Hypr Framebuffer
|
// bind the offload Hypr Framebuffer
|
||||||
m_RenderData.pCurrentMonData->offloadFB.bind();
|
m_RenderData.pCurrentMonData->offloadFB.bind();
|
||||||
|
@ -307,9 +308,10 @@ void CHyprOpenGLImpl::end() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset our data
|
// reset our data
|
||||||
m_RenderData.pMonitor = nullptr;
|
m_RenderData.pMonitor = nullptr;
|
||||||
m_RenderData.mouseZoomFactor = 1.f;
|
m_RenderData.mouseZoomFactor = 1.f;
|
||||||
m_RenderData.mouseZoomUseMouse = true;
|
m_RenderData.mouseZoomUseMouse = true;
|
||||||
|
m_RenderData.forceIntrospection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::initShaders() {
|
void CHyprOpenGLImpl::initShaders() {
|
||||||
|
@ -639,12 +641,12 @@ void CHyprOpenGLImpl::renderRectWithDamage(CBox* box, const CColor& col, CRegion
|
||||||
TRACY_GPU_ZONE("RenderRectWithDamage");
|
TRACY_GPU_ZONE("RenderRectWithDamage");
|
||||||
|
|
||||||
CBox newBox = *box;
|
CBox newBox = *box;
|
||||||
newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
|
m_RenderData.renderModif.applyToBox(newBox);
|
||||||
|
|
||||||
box = &newBox;
|
box = &newBox;
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
|
wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), newBox.rot,
|
||||||
m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here
|
m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
|
@ -725,14 +727,14 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox*
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CBox newBox = *pBox;
|
CBox newBox = *pBox;
|
||||||
newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
|
m_RenderData.renderModif.applyToBox(newBox);
|
||||||
|
|
||||||
static auto* const PDIMINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue;
|
static auto* const PDIMINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue;
|
||||||
|
|
||||||
// get transform
|
// get transform
|
||||||
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->projMatrix.data());
|
wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, newBox.rot, m_RenderData.pMonitor->projMatrix.data());
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
|
@ -888,12 +890,12 @@ void CHyprOpenGLImpl::renderTexturePrimitive(const CTexture& tex, CBox* pBox) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CBox newBox = *pBox;
|
CBox newBox = *pBox;
|
||||||
newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
|
m_RenderData.renderModif.applyToBox(newBox);
|
||||||
|
|
||||||
// get transform
|
// get transform
|
||||||
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->projMatrix.data());
|
wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, newBox.rot, m_RenderData.pMonitor->projMatrix.data());
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
|
@ -942,12 +944,12 @@ void CHyprOpenGLImpl::renderTextureMatte(const CTexture& tex, CBox* pBox, CFrame
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CBox newBox = *pBox;
|
CBox newBox = *pBox;
|
||||||
newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
|
m_RenderData.renderModif.applyToBox(newBox);
|
||||||
|
|
||||||
// get transform
|
// get transform
|
||||||
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->projMatrix.data());
|
wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, newBox.rot, m_RenderData.pMonitor->projMatrix.data());
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||||
|
@ -1477,14 +1479,14 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, CC
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CBox newBox = *box;
|
CBox newBox = *box;
|
||||||
newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
|
m_RenderData.renderModif.applyToBox(newBox);
|
||||||
|
|
||||||
box = &newBox;
|
box = &newBox;
|
||||||
|
|
||||||
if (borderSize < 1)
|
if (borderSize < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int scaledBorderSize = std::round(borderSize * m_RenderData.pMonitor->scale * m_RenderData.renderModif.scale);
|
int scaledBorderSize = std::round(borderSize * m_RenderData.pMonitor->scale);
|
||||||
|
|
||||||
// adjust box
|
// adjust box
|
||||||
box->x -= scaledBorderSize;
|
box->x -= scaledBorderSize;
|
||||||
|
@ -1495,7 +1497,7 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, CC
|
||||||
radii += radii == 0 ? 0 : scaledBorderSize;
|
radii += radii == 0 ? 0 : scaledBorderSize;
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
|
wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), newBox.rot,
|
||||||
m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here
|
m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
|
@ -1783,7 +1785,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, CCornerRadiiData radii, int
|
||||||
TRACY_GPU_ZONE("RenderShadow");
|
TRACY_GPU_ZONE("RenderShadow");
|
||||||
|
|
||||||
CBox newBox = *box;
|
CBox newBox = *box;
|
||||||
newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
|
m_RenderData.renderModif.applyToBox(newBox);
|
||||||
|
|
||||||
box = &newBox;
|
box = &newBox;
|
||||||
|
|
||||||
|
@ -1794,7 +1796,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, CCornerRadiiData radii, int
|
||||||
const auto col = color;
|
const auto col = color;
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
|
wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), newBox.rot,
|
||||||
m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here
|
m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
|
@ -2218,4 +2220,26 @@ const SGLPixelFormat* CHyprOpenGLImpl::getPixelFormatFromDRM(uint32_t drmFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SRenderModifData::applyToBox(CBox& box) {
|
||||||
|
for (auto& [type, val] : modifs) {
|
||||||
|
try {
|
||||||
|
switch (type) {
|
||||||
|
case RMOD_TYPE_SCALE: box.scale(std::any_cast<float>(val)); break;
|
||||||
|
case RMOD_TYPE_SCALECENTER: box.scaleFromCenter(std::any_cast<float>(val)); break;
|
||||||
|
case RMOD_TYPE_TRANSLATE: box.translate(std::any_cast<Vector2D>(val)); break;
|
||||||
|
case RMOD_TYPE_ROTATE: box.rot += std::any_cast<float>(val); break;
|
||||||
|
case RMOD_TYPE_ROTATECENTER: {
|
||||||
|
const auto THETA = std::any_cast<float>(val);
|
||||||
|
const double COS = std::cos(THETA);
|
||||||
|
const double SIN = std::sin(THETA);
|
||||||
|
box.rot += THETA;
|
||||||
|
const auto OLDPOS = box.pos();
|
||||||
|
box.x = OLDPOS.x * COS - OLDPOS.y * SIN;
|
||||||
|
box.y = OLDPOS.y * COS + OLDPOS.x * SIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (std::bad_any_cast& e) { Debug::log(ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::applyToBox!"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -36,8 +36,17 @@ enum eDiscardMode {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SRenderModifData {
|
struct SRenderModifData {
|
||||||
Vector2D translate = {};
|
enum eRenderModifType {
|
||||||
float scale = 1.f;
|
RMOD_TYPE_SCALE, /* scale by a float */
|
||||||
|
RMOD_TYPE_SCALECENTER, /* scale by a float from the center */
|
||||||
|
RMOD_TYPE_TRANSLATE, /* translate by a Vector2D */
|
||||||
|
RMOD_TYPE_ROTATE, /* rotate by a float in rad from top left */
|
||||||
|
RMOD_TYPE_ROTATECENTER, /* rotate by a float in rad from center */
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::pair<eRenderModifType, std::any>> modifs;
|
||||||
|
|
||||||
|
void applyToBox(CBox& box);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SGLPixelFormat {
|
struct SGLPixelFormat {
|
||||||
|
@ -99,6 +108,7 @@ struct SCurrentRenderData {
|
||||||
float mouseZoomFactor = 1.f;
|
float mouseZoomFactor = 1.f;
|
||||||
bool mouseZoomUseMouse = true; // true by default
|
bool mouseZoomUseMouse = true; // true by default
|
||||||
bool useNearestNeighbor = false;
|
bool useNearestNeighbor = false;
|
||||||
|
bool forceIntrospection = false; // cleaned in ::end()
|
||||||
|
|
||||||
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
||||||
Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);
|
Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);
|
||||||
|
|
|
@ -653,13 +653,17 @@ void CHyprRenderer::renderSessionLockSurface(SSessionLockSurface* pSurface, CMon
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time, const Vector2D& translate, const float& scale) {
|
void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time, const Vector2D& translate, const float& scale) {
|
||||||
static auto* const PDIMSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:dim_special")->floatValue;
|
static auto* const PDIMSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:dim_special")->floatValue;
|
||||||
static auto* const PBLURSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:blur:special")->intValue;
|
static auto* const PBLURSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:blur:special")->intValue;
|
||||||
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue;
|
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue;
|
||||||
static auto* const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue;
|
static auto* const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue;
|
||||||
static auto* const PBACKGROUNDCOLOR = &g_pConfigManager->getConfigValuePtr("misc:background_color")->intValue;
|
static auto* const PBACKGROUNDCOLOR = &g_pConfigManager->getConfigValuePtr("misc:background_color")->intValue;
|
||||||
|
|
||||||
const SRenderModifData RENDERMODIFDATA = {translate, scale};
|
SRenderModifData RENDERMODIFDATA;
|
||||||
|
if (translate != Vector2D{0, 0})
|
||||||
|
RENDERMODIFDATA.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_TRANSLATE, translate});
|
||||||
|
if (scale != 1.f)
|
||||||
|
RENDERMODIFDATA.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_SCALE, scale});
|
||||||
|
|
||||||
if (!pMonitor)
|
if (!pMonitor)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue