mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 21:45:58 +01:00
Merge branch 'resize-on-border' of github.com:horriblename/Hyprland
This commit is contained in:
commit
75219b206b
12 changed files with 86 additions and 43 deletions
36
flake.lock
36
flake.lock
|
@ -1,29 +1,17 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"hyprland-protocols": {
|
"hyprland-protocols": {
|
||||||
"flake": false,
|
"inputs": {
|
||||||
"locked": {
|
"nixpkgs": [
|
||||||
"lastModified": 1670703428,
|
"nixpkgs"
|
||||||
"narHash": "sha256-4KUW5SKR0Y9uaYGcYwy53YJ3B/sgiprCL4fRGO+mpOA=",
|
]
|
||||||
"owner": "hyprwm",
|
|
||||||
"repo": "hyprland-protocols",
|
|
||||||
"rev": "d0d6db8cb5bef6d93ca3ad8fb2124964173396da",
|
|
||||||
"type": "github"
|
|
||||||
},
|
},
|
||||||
"original": {
|
|
||||||
"owner": "hyprwm",
|
|
||||||
"repo": "hyprland-protocols",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"hyprland-protocols_2": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1670703428,
|
"lastModified": 1671839510,
|
||||||
"narHash": "sha256-4KUW5SKR0Y9uaYGcYwy53YJ3B/sgiprCL4fRGO+mpOA=",
|
"narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprland-protocols",
|
"repo": "hyprland-protocols",
|
||||||
"rev": "d0d6db8cb5bef6d93ca3ad8fb2124964173396da",
|
"rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -76,17 +64,19 @@
|
||||||
},
|
},
|
||||||
"xdph": {
|
"xdph": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"hyprland-protocols": "hyprland-protocols_2",
|
"hyprland-protocols": [
|
||||||
|
"hyprland-protocols"
|
||||||
|
],
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1671837878,
|
"lastModified": 1673116118,
|
||||||
"narHash": "sha256-OmFDyktTc/l+3wHboHeFpAQgPt3r7jjqZf8MrwuUGMo=",
|
"narHash": "sha256-eR0yDSkR2XYMesfdRWJs25kAdXET2mbNNHu5t+KUcKA=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "e47f4cec698080768821b271510985ab94a37e91",
|
"rev": "d479c846531fd0e1d2357c9588b8310a2b859ef2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
13
flake.nix
13
flake.nix
|
@ -8,14 +8,15 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
xdph = {
|
hyprland-protocols = {
|
||||||
url = "github:hyprwm/xdg-desktop-portal-hyprland";
|
url = "github:hyprwm/hyprland-protocols";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
hyprland-protocols = {
|
xdph = {
|
||||||
url = "github:hyprwm/hyprland-protocols";
|
url = "github:hyprwm/xdg-desktop-portal-hyprland";
|
||||||
flake = false;
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.hyprland-protocols.follows = "hyprland-protocols";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@
|
||||||
stdenv = prev.gcc12Stdenv;
|
stdenv = prev.gcc12Stdenv;
|
||||||
version = props.version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
version = props.version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||||
wlroots = wlroots-hyprland;
|
wlroots = wlroots-hyprland;
|
||||||
inherit (inputs) hyprland-protocols;
|
inherit (inputs.hyprland-protocols.packages.${prev.hostPlatform.system}) hyprland-protocols;
|
||||||
};
|
};
|
||||||
hyprland-debug = hyprland.override {debug = true;};
|
hyprland-debug = hyprland.override {debug = true;};
|
||||||
hyprland-no-hidpi = hyprland.override {hidpiXWayland = false;};
|
hyprland-no-hidpi = hyprland.override {hidpiXWayland = false;};
|
||||||
|
|
|
@ -67,6 +67,7 @@ in
|
||||||
[
|
[
|
||||||
git
|
git
|
||||||
cairo
|
cairo
|
||||||
|
hyprland-protocols
|
||||||
libdrm
|
libdrm
|
||||||
libinput
|
libinput
|
||||||
libxkbcommon
|
libxkbcommon
|
||||||
|
@ -99,10 +100,6 @@ in
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
# Fix hardcoded paths to /usr installation
|
# Fix hardcoded paths to /usr installation
|
||||||
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
|
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
|
||||||
|
|
||||||
# for some reason rmdir doesn't work in a dirty tree
|
|
||||||
rmdir subprojects/hyprland-protocols || true
|
|
||||||
ln -s ${hyprland-protocols} subprojects/hyprland-protocols
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.providedSessions = ["hyprland"];
|
passthru.providedSessions = ["hyprland"];
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version": "0.20.0"}
|
{"version": "0.20.1"}
|
||||||
|
|
|
@ -49,7 +49,7 @@ CCompositor::CCompositor() {
|
||||||
|
|
||||||
Debug::log(NONE, "\n\n"); // pad
|
Debug::log(NONE, "\n\n"); // pad
|
||||||
|
|
||||||
Debug::log(INFO, "If you are crashing, or encounter any bugs, please consult https://github.com/hyprwm/Hyprland/wiki/Crashing-and-bugs\n\n");
|
Debug::log(INFO, "If you are crashing, or encounter any bugs, please consult https://wiki.hyprland.org/Crashes-and-Bugs/\n\n");
|
||||||
|
|
||||||
setRandomSplash();
|
setRandomSplash();
|
||||||
|
|
||||||
|
@ -391,11 +391,10 @@ void CCompositor::startCompositor() {
|
||||||
if (sd_booted() > 0)
|
if (sd_booted() > 0)
|
||||||
// tell systemd that we are ready so it can start other bond, following, related units
|
// tell systemd that we are ready so it can start other bond, following, related units
|
||||||
sd_notify(0, "READY=1");
|
sd_notify(0, "READY=1");
|
||||||
else
|
else
|
||||||
Debug::log(LOG, "systemd integration is baked in but system itself is not booted à la systemd!");
|
Debug::log(LOG, "systemd integration is baked in but system itself is not booted à la systemd!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// This blocks until we are done.
|
// This blocks until we are done.
|
||||||
Debug::log(LOG, "Hyprland is ready, running the event loop!");
|
Debug::log(LOG, "Hyprland is ready, running the event loop!");
|
||||||
wl_display_run(m_sWLDisplay);
|
wl_display_run(m_sWLDisplay);
|
||||||
|
@ -2071,6 +2070,20 @@ CWorkspace* CCompositor::createNewWorkspace(const int& id, const int& monid, con
|
||||||
return PWORKSPACE;
|
return PWORKSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCompositor::renameWorkspace(const int& id, const std::string& name) {
|
||||||
|
const auto PWORKSPACE = getWorkspaceByID(id);
|
||||||
|
|
||||||
|
if (!PWORKSPACE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (isWorkspaceSpecial(id))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Debug::log(LOG, "renameWorkspace: Renaming workspace %d to '%s'", id, name);
|
||||||
|
wlr_ext_workspace_handle_v1_set_name(PWORKSPACE->m_pWlrHandle, name.c_str());
|
||||||
|
PWORKSPACE->m_szName = name;
|
||||||
|
}
|
||||||
|
|
||||||
void CCompositor::setActiveMonitor(CMonitor* pMonitor) {
|
void CCompositor::setActiveMonitor(CMonitor* pMonitor) {
|
||||||
if (m_pLastMonitor == pMonitor)
|
if (m_pLastMonitor == pMonitor)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -171,6 +171,7 @@ class CCompositor {
|
||||||
void forceReportSizesToWindowsOnWorkspace(const int&);
|
void forceReportSizesToWindowsOnWorkspace(const int&);
|
||||||
bool cursorOnReservedArea();
|
bool cursorOnReservedArea();
|
||||||
CWorkspace* createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
|
CWorkspace* createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
|
||||||
|
void renameWorkspace(const int&, const std::string& name = "");
|
||||||
void setActiveMonitor(CMonitor*);
|
void setActiveMonitor(CMonitor*);
|
||||||
bool isWorkspaceSpecial(const int&);
|
bool isWorkspaceSpecial(const int&);
|
||||||
int getNewSpecialID();
|
int getNewSpecialID();
|
||||||
|
|
|
@ -216,10 +216,12 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur_passes")->intValue;
|
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur_passes")->intValue;
|
||||||
const auto BLURRADIUS = *PBLURSIZE * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
|
const auto BLURRADIUS = *PBLURSIZE * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
|
||||||
|
|
||||||
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
|
|
||||||
|
|
||||||
// now, prep the damage, get the extended damage region
|
// now, prep the damage, get the extended damage region
|
||||||
wlr_region_expand(&damage, &damage, BLURRADIUS); // expand for proper blurring
|
wlr_region_expand(&damage, &damage, BLURRADIUS); // expand for proper blurring
|
||||||
|
|
||||||
|
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
|
||||||
|
|
||||||
|
wlr_region_expand(&damage, &damage, BLURRADIUS); // expand for proper blurring 2
|
||||||
} else {
|
} else {
|
||||||
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
|
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
|
||||||
}
|
}
|
||||||
|
@ -280,7 +282,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
pixman_region32_init(&frameDamage);
|
pixman_region32_init(&frameDamage);
|
||||||
|
|
||||||
const auto TRANSFORM = wlr_output_transform_invert(PMONITOR->output->transform);
|
const auto TRANSFORM = wlr_output_transform_invert(PMONITOR->output->transform);
|
||||||
wlr_region_transform(&frameDamage, &PMONITOR->damage->current, TRANSFORM, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
|
wlr_region_transform(&frameDamage, &g_pHyprOpenGL->m_rOriginalDamageRegion, TRANSFORM, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
|
||||||
|
|
||||||
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
|
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
|
||||||
pixman_region32_union_rect(&frameDamage, &frameDamage, 0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
|
pixman_region32_union_rect(&frameDamage, &frameDamage, 0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
CColor::CColor() {}
|
CColor::CColor() {}
|
||||||
|
|
||||||
CColor::CColor(float r, float g, float b, float a) {
|
CColor::CColor(float r, float g, float b, float a) {
|
||||||
RASSERT(r <= 1.f && g <= 1.f && b <= 1.f && a <= 1.f, "un-normalized color assignment");
|
|
||||||
this->r = r;
|
this->r = r;
|
||||||
this->g = g;
|
this->g = g;
|
||||||
this->b = b;
|
this->b = b;
|
||||||
|
|
|
@ -10,6 +10,7 @@ CKeybindManager::CKeybindManager() {
|
||||||
m_mDispatchers["closewindow"] = kill;
|
m_mDispatchers["closewindow"] = kill;
|
||||||
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
||||||
m_mDispatchers["workspace"] = changeworkspace;
|
m_mDispatchers["workspace"] = changeworkspace;
|
||||||
|
m_mDispatchers["renameworkspace"] = renameWorkspace;
|
||||||
m_mDispatchers["fullscreen"] = fullscreenActive;
|
m_mDispatchers["fullscreen"] = fullscreenActive;
|
||||||
m_mDispatchers["fakefullscreen"] = fakeFullscreenActive;
|
m_mDispatchers["fakefullscreen"] = fakeFullscreenActive;
|
||||||
m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
|
m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
|
||||||
|
@ -294,6 +295,14 @@ void CKeybindManager::onSwitchEvent(const std::string& switchName) {
|
||||||
handleKeybinds(0, "switch:" + switchName, 0, 0, true, 0);
|
handleKeybinds(0, "switch:" + switchName, 0, 0, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::onSwitchOnEvent(const std::string& switchName) {
|
||||||
|
handleKeybinds(0, "switch:on:" + switchName, 0, 0, true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::onSwitchOffEvent(const std::string& switchName) {
|
||||||
|
handleKeybinds(0, "switch:off:" + switchName, 0, 0, true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int repeatKeyHandler(void* data) {
|
int repeatKeyHandler(void* data) {
|
||||||
SKeybind** ppActiveKeybind = (SKeybind**)data;
|
SKeybind** ppActiveKeybind = (SKeybind**)data;
|
||||||
|
|
||||||
|
@ -1297,6 +1306,21 @@ void CKeybindManager::workspaceOpt(std::string args) {
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_pLastMonitor->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_pLastMonitor->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::renameWorkspace(std::string args) {
|
||||||
|
try {
|
||||||
|
const auto FIRSTSPACEPOS = args.find_first_of(' ');
|
||||||
|
if (FIRSTSPACEPOS != std::string::npos) {
|
||||||
|
int workspace = std::stoi(args.substr(0, FIRSTSPACEPOS));
|
||||||
|
std::string name = args.substr(FIRSTSPACEPOS + 1);
|
||||||
|
g_pCompositor->renameWorkspace(workspace, name);
|
||||||
|
} else {
|
||||||
|
g_pCompositor->renameWorkspace(std::stoi(args), "");
|
||||||
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
Debug::log(ERR, "Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"%s\": \"%s\"", args.c_str(), e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CKeybindManager::exitHyprland(std::string argz) {
|
void CKeybindManager::exitHyprland(std::string argz) {
|
||||||
g_pCompositor->cleanup();
|
g_pCompositor->cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ class CKeybindManager {
|
||||||
bool onMouseEvent(wlr_pointer_button_event*);
|
bool onMouseEvent(wlr_pointer_button_event*);
|
||||||
void onGapDragEvent(wlr_pointer_button_event*);
|
void onGapDragEvent(wlr_pointer_button_event*);
|
||||||
void onSwitchEvent(const std::string&);
|
void onSwitchEvent(const std::string&);
|
||||||
|
void onSwitchOnEvent(const std::string&);
|
||||||
|
void onSwitchOffEvent(const std::string&);
|
||||||
|
|
||||||
void addKeybind(SKeybind);
|
void addKeybind(SKeybind);
|
||||||
void removeKeybind(uint32_t, const std::string&);
|
void removeKeybind(uint32_t, const std::string&);
|
||||||
|
@ -105,6 +107,7 @@ class CKeybindManager {
|
||||||
static void toggleSplit(std::string);
|
static void toggleSplit(std::string);
|
||||||
static void moveCursorToCorner(std::string);
|
static void moveCursorToCorner(std::string);
|
||||||
static void workspaceOpt(std::string);
|
static void workspaceOpt(std::string);
|
||||||
|
static void renameWorkspace(std::string);
|
||||||
static void exitHyprland(std::string);
|
static void exitHyprland(std::string);
|
||||||
static void moveCurrentWorkspaceToMonitor(std::string);
|
static void moveCurrentWorkspaceToMonitor(std::string);
|
||||||
static void moveWorkspaceToMonitor(std::string);
|
static void moveWorkspaceToMonitor(std::string);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "InputManager.hpp"
|
#include "InputManager.hpp"
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "wlr/util/box.h"
|
#include "wlr/types/wlr_switch.h"
|
||||||
|
|
||||||
const bool TEMP_CONFIG_RESIZE_ON_BORDER = true;
|
const bool TEMP_CONFIG_RESIZE_ON_BORDER = true;
|
||||||
|
|
||||||
|
@ -1233,6 +1233,18 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
|
||||||
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);
|
||||||
|
|
||||||
|
const auto event_data = (wlr_switch_toggle_event*)data;
|
||||||
|
switch (event_data->switch_state) {
|
||||||
|
case WLR_SWITCH_STATE_ON:
|
||||||
|
Debug::log(LOG, "Switch %s turn on, triggering binds.", NAME.c_str());
|
||||||
|
g_pKeybindManager->onSwitchOnEvent(NAME);
|
||||||
|
break;
|
||||||
|
case WLR_SWITCH_STATE_OFF:
|
||||||
|
Debug::log(LOG, "Switch %s turn off, triggering binds.", NAME.c_str());
|
||||||
|
g_pKeybindManager->onSwitchOffEvent(NAME);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
PNEWDEV, "SwitchDevice");
|
PNEWDEV, "SwitchDevice");
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,7 +460,8 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
||||||
bool allowCustomUV, bool allowDim) {
|
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!");
|
||||||
RASSERT(alpha <= 1.0, "Tried to render texture with a > 1");
|
|
||||||
|
alpha = std::clamp(alpha, 0.f, 1.f);
|
||||||
|
|
||||||
if (!pixman_region32_not_empty(m_RenderData.pDamage))
|
if (!pixman_region32_not_empty(m_RenderData.pDamage))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue