Skip to content

Commit

Permalink
Merge branch 'hyprwm:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjamt authored Feb 15, 2025
2 parents 86c3f2c + 2f96703 commit d399ff8
Show file tree
Hide file tree
Showing 49 changed files with 521 additions and 396 deletions.
48 changes: 24 additions & 24 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,11 @@

nixosModules.default = import ./nix/module.nix inputs;
homeManagerModules.default = import ./nix/hm-module.nix self;

# Hydra build jobs
# Recent versions of Hydra can aggregate jobsets from 'hydraJobs' intead of a release.nix
# or similar. Remember to filter large or incompatible attributes here. More eval jobs can
# be added by merging, e.g., self.packages // self.devShells.
hydraJobs = self.packages;
};
}
14 changes: 14 additions & 0 deletions nix/overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ in {
inputs.hyprlang.overlays.default
inputs.hyprutils.overlays.default
inputs.hyprwayland-scanner.overlays.default
self.overlays.wayland-protocols-bump
self.overlays.udis86

# Hyprland packages themselves
Expand Down Expand Up @@ -89,4 +90,17 @@ in {
patches = [];
});
};

# Temporary bump until https://nixpk.gs/pr-tracker.html?pr=367753 is merged.
# Expect to build the universe.
wayland-protocols-bump = final: prev: {
wayland-protocols = prev.wayland-protocols.overrideAttrs (self: super: {
version = "1.40";

src = prev.fetchurl {
url = "https://gitlab.freedesktop.org/wayland/${super.pname}/-/releases/${self.version}/downloads/${super.pname}-${self.version}.tar.xz";
hash = "sha256-shcReTJHwsQnY5FDkt+p/LnjcoyktKoRCtuNkV/ABok=";
};
});
};
}
2 changes: 1 addition & 1 deletion protocols/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
wayland_protos = dependency(
'wayland-protocols',
version: '>=1.32',
version: '>=1.40',
fallback: 'wayland-protocols',
default_options: ['tests=false'],
)
Expand Down
9 changes: 9 additions & 0 deletions scripts/generateVersion.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/bin/sh

# if the git directory doesn't exist, don't gather data to avoid overwriting, unless
# the version file is missing altogether (otherwise compiling will fail)
if [[ ! -d ./.git ]]; then
if [[ -f ./src/version.h ]]; then
exit 0
fi
fi

cp -fr ./src/version.h.in ./src/version.h

HASH=${HASH-$(git rev-parse HEAD)}
Expand Down
24 changes: 20 additions & 4 deletions src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <malloc.h>
#include <unistd.h>

using namespace Hyprutils::String;
using namespace Aquamarine;
Expand Down Expand Up @@ -162,10 +164,22 @@ void CCompositor::restoreNofile() {
Debug::log(ERR, "Failed restoring NOFILE limits");
}

void CCompositor::setMallocThreshold() {
#ifdef M_TRIM_THRESHOLD
// The default is 128 pages,
// which is very large and can lead to a lot of memory used for no reason
// because trimming hasn't happened
static const int PAGESIZE = sysconf(_SC_PAGESIZE);
mallopt(M_TRIM_THRESHOLD, 6 * PAGESIZE);
#endif
}

CCompositor::CCompositor(bool onlyConfig) : m_bOnlyConfigVerification(onlyConfig), m_iHyprlandPID(getpid()) {
if (onlyConfig)
return;

setMallocThreshold();

m_szHyprTempDataRoot = std::string{getenv("XDG_RUNTIME_DIR")} + "/hypr";

if (m_szHyprTempDataRoot.starts_with("/hypr")) {
Expand Down Expand Up @@ -372,7 +386,6 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
}

setenv("WAYLAND_DISPLAY", m_szWLDisplaySocket.c_str(), 1);
setenv("XDG_SESSION_TYPE", "wayland", 1);
if (!getenv("XDG_CURRENT_DESKTOP")) {
setenv("XDG_CURRENT_DESKTOP", "Hyprland", 1);
m_bDesktopEnvSet = true;
Expand Down Expand Up @@ -1189,6 +1202,9 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface

if (*PFOLLOWMOUSE == 0)
g_pInputManager->sendMotionEventsToFocused();

if (pWindow->m_sGroupData.pNextWindow)
pWindow->deactivateGroupMembers();
}

void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindowOwner) {
Expand Down Expand Up @@ -1245,7 +1261,7 @@ void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindo
SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, PHLMONITOR monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
for (auto const& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
for (auto const& ls : lsl | std::views::reverse) {
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha->value() == 0.f)
if (!ls->mapped || ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha->value() == 0.f)
continue;

auto SURFACEAT = ls->popupHead->at(pos, true);
Expand All @@ -1263,7 +1279,7 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& po

SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLSREF>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
for (auto const& ls : *layerSurfaces | std::views::reverse) {
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha->value() == 0.f)
if (!ls->mapped || ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha->value() == 0.f)
continue;

auto [surf, local] = ls->layerSurface->surface->at(pos - ls->geometry.pos(), true);
Expand Down Expand Up @@ -2330,7 +2346,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS

updateFullscreenFadeOnWorkspace(PWORKSPACE);

PWINDOW->sendWindowSize(PWINDOW->m_vRealSize->goal(), true);
PWINDOW->sendWindowSize(true);

PWORKSPACE->forceReportSizesToWindows();

Expand Down
5 changes: 3 additions & 2 deletions src/Compositor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class CCompositor {
void startCompositor();
void stopCompositor();
void cleanup();
void createLockFile();
void removeLockFile();
void bumpNofile();
void restoreNofile();

Expand Down Expand Up @@ -163,6 +161,9 @@ class CCompositor {
void setRandomSplash();
void initManagers(eManagersInitStage stage);
void prepareFallbackOutput();
void createLockFile();
void removeLockFile();
void setMallocThreshold();

uint64_t m_iHyprlandPID = 0;
wl_event_source* m_critSigSource = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/config/ConfigDescriptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.value = "binds:movefocus_cycles_fullscreen",
.description = "If enabled, when on a fullscreen window, movefocus will cycle fullscreen, if not, it will move the focus in a direction.",
.type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{true},
.data = SConfigOptionDescription::SBoolData{false},
},
SConfigOptionDescription{
.value = "binds:movefocus_cycles_groupfirst",
Expand Down Expand Up @@ -1356,7 +1356,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
},
SConfigOptionDescription{
.value = "cursor:no_hardware_cursors",
.description = "disables hardware cursors",
.description = "disables hardware cursors. Auto = disable when tearing",
.type = CONFIG_OPTION_CHOICE,
.data = SConfigOptionDescription::SChoiceData{0, "Disabled,Enabled,Auto"},
},
Expand Down
13 changes: 7 additions & 6 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("binds:workspace_center_on", Hyprlang::INT{1});
m_pConfig->addConfigValue("binds:focus_preferred_method", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:ignore_group_lock", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:movefocus_cycles_fullscreen", Hyprlang::INT{1});
m_pConfig->addConfigValue("binds:movefocus_cycles_fullscreen", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:movefocus_cycles_groupfirst", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:disable_keybind_grabbing", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:window_direction_monitor_fallback", Hyprlang::INT{1});
Expand All @@ -621,7 +621,7 @@ CConfigManager::CConfigManager() {

m_pConfig->addConfigValue("opengl:nvidia_anti_flicker", Hyprlang::INT{1});

m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{0});
m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{2});
m_pConfig->addConfigValue("cursor:no_break_fs_vrr", Hyprlang::INT{2});
m_pConfig->addConfigValue("cursor:min_refresh_rate", Hyprlang::INT{24});
m_pConfig->addConfigValue("cursor:hotspot_padding", Hyprlang::INT{0});
Expand Down Expand Up @@ -885,9 +885,9 @@ void CConfigManager::setDefaultAnimationVars() {
m_AnimationTree.createNode("specialWorkspaceOut", "specialWorkspace");

// init the root nodes
m_AnimationTree.setConfigForNode("global", 1, 8.f, "", "default");
m_AnimationTree.setConfigForNode("__internal_fadeCTM", 1, 5.f, "", "linear");
m_AnimationTree.setConfigForNode("borderangle", 0, 0.f, "", "default");
m_AnimationTree.setConfigForNode("global", 1, 8.f, "default");
m_AnimationTree.setConfigForNode("__internal_fadeCTM", 1, 5.f, "linear");
m_AnimationTree.setConfigForNode("borderangle", 0, 1, "default");
}

std::optional<std::string> CConfigManager::resetHLConfig() {
Expand Down Expand Up @@ -2798,12 +2798,13 @@ const std::vector<SConfigOptionDescription>& CConfigManager::getAllDescriptions(
return CONFIG_OPTIONS;
}

bool CConfigManager::shouldUseSoftwareCursors() {
bool CConfigManager::shouldUseSoftwareCursors(PHLMONITOR pMonitor) {
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");

switch (*PNOHW) {
case 0: return false;
case 1: return true;
case 2: return pMonitor->tearingState.activelyTearing;
default: break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/ConfigManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class CConfigManager {
void ensureMonitorStatus();
void ensureVRR(PHLMONITOR pMonitor = nullptr);

bool shouldUseSoftwareCursors();
bool shouldUseSoftwareCursors(PHLMONITOR pMonitor);
void updateWatcher();

std::string parseKeyword(const std::string&, const std::string&);
Expand Down
17 changes: 9 additions & 8 deletions src/desktop/Popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,19 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
continue;

if (!allowsInput) {
const Vector2D offset =
p->m_pResource && p->m_pResource->surface ? (p->size() - p->m_pResource->geometry.size()) / 2.F - p->m_pResource->surface->current.geometry.pos() : Vector2D{};
const Vector2D size = p->m_pResource ? p->m_pResource->geometry.size() : p->size();
const bool HASSURFACE = p->m_pResource && p->m_pResource->surface;

const auto BOX = CBox{p->coordsGlobal() + offset, size};
Vector2D offset = HASSURFACE ? p->m_pResource->surface->current.geometry.pos() : Vector2D{};
Vector2D size = HASSURFACE ? p->m_pResource->surface->current.geometry.size() : p->size();

if (size == Vector2D{})
size = p->size();

const auto BOX = CBox{p->coordsGlobal() + offset, size};
if (BOX.containsPoint(globalCoords))
return p;
} else {
const Vector2D offset =
p->m_pResource && p->m_pResource->surface ? (p->size() - p->m_pResource->geometry.size()) / 2.F - p->m_pResource->surface->current.geometry.pos() : Vector2D{};
const auto REGION =
CRegion{p->m_pWLSurface->resource()->current.input}.intersect(CBox{{}, p->m_pWLSurface->resource()->current.size}).translate(p->coordsGlobal() + offset);
const auto REGION = CRegion{p->m_pWLSurface->resource()->current.input}.intersect(CBox{{}, p->m_pWLSurface->resource()->current.size}).translate(p->coordsGlobal());
if (REGION.containsPoint(globalCoords))
return p;
}
Expand Down
Loading

0 comments on commit d399ff8

Please sign in to comment.