mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-27 09:53:47 -07:00
Compare commits
81 Commits
v0.15.0bet
...
v0.15.2bet
Author | SHA1 | Date | |
---|---|---|---|
|
cb687c208c | ||
|
945b4d7139 | ||
|
881f828250 | ||
|
0743dab3f0 | ||
|
496e37d044 | ||
|
1263bd5dcb | ||
|
9ee78b1a92 | ||
|
90f2259f5e | ||
|
948f4978e7 | ||
|
fe4a97f245 | ||
|
2f3528c076 | ||
|
1964bcb13f | ||
|
4b779ac142 | ||
|
abc2d442dd | ||
|
b64f1fc5c4 | ||
|
33d264eaa7 | ||
|
5e3b8c3233 | ||
|
bbdfb7853d | ||
|
a19b152e4a | ||
|
1468001d3b | ||
|
7faa3c367d | ||
|
fd379db846 | ||
|
28a6e0ce31 | ||
|
af7d60b3f8 | ||
|
c4487534d2 | ||
|
e4820d1c71 | ||
|
b4a8efc1a7 | ||
|
9480c0fb90 | ||
|
f901c60da5 | ||
|
922e978f56 | ||
|
0508c7d384 | ||
|
ee3b770cfd | ||
|
a29af89545 | ||
|
552c4b7361 | ||
|
d7ef19e2e7 | ||
|
190ddb5697 | ||
|
095688712d | ||
|
d264fbd36a | ||
|
e4527c6b60 | ||
|
32e8eda40a | ||
|
477ad2dd82 | ||
|
e90c5c6347 | ||
|
11ce468996 | ||
|
9c5023ab1a | ||
|
0e4a894edb | ||
|
71e2562a41 | ||
|
9153a81090 | ||
|
0d7f6eac9e | ||
|
6d46ed4011 | ||
|
f825b87c2a | ||
|
44da575ea8 | ||
|
a587909fd5 | ||
|
fd81ba5a4f | ||
|
934f81c93d | ||
|
e8be1507ef | ||
|
60c414ccad | ||
|
0d702b556d | ||
|
9bbae5b8e2 | ||
|
719a5b4f0b | ||
|
7bdfdaa28a | ||
|
a80e0cecfe | ||
|
3e3f6aef5e | ||
|
996938b7e7 | ||
|
f9325b1655 | ||
|
63dfe305dd | ||
|
ec0c6fa22a | ||
|
c6333ba796 | ||
|
6fe103cf06 | ||
|
71733f68ef | ||
|
d867d42366 | ||
|
6eb7d00386 | ||
|
09268d756f | ||
|
e5dced8b3f | ||
|
b38e7b596f | ||
|
1424539e4d | ||
|
425b07d1e5 | ||
|
65fb526d5c | ||
|
0549aa193f | ||
|
168a326609 | ||
|
7edbaea23d | ||
|
5ff44467d7 |
12
flake.lock
generated
12
flake.lock
generated
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1664687381,
|
"lastModified": 1665259268,
|
||||||
"narHash": "sha256-9czSuDzS+OGGwq2kC4KXBLXWfYaup+oLB+AA1Md25U4=",
|
"narHash": "sha256-ONFhHBLv5nZKhwV/F2GOH16197PbvpyWhoO0AOyktkU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "59d2991d4256cdca1c0cda45d876c80a0fe45c31",
|
"rev": "c5924154f000e6306030300592f4282949b2db6c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"host": "gitlab.freedesktop.org",
|
"host": "gitlab.freedesktop.org",
|
||||||
"lastModified": 1664816798,
|
"lastModified": 1665331677,
|
||||||
"narHash": "sha256-oLJyFT1Fc4UNNaDSN+EYUAWL4CufCBpuS5AV4Z4XANo=",
|
"narHash": "sha256-3Dh1i11mHK80jx5figC1oh1V0rCjieh0Mj+MajXdbPw=",
|
||||||
"owner": "wlroots",
|
"owner": "wlroots",
|
||||||
"repo": "wlroots",
|
"repo": "wlroots",
|
||||||
"rev": "50cc1ef4d3791d86854dd83c15fff17e5ea1a5b6",
|
"rev": "ab8341975e62b1f668d8c9779ec8e72d04718a99",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@@ -58,7 +58,7 @@
|
|||||||
};
|
};
|
||||||
hyprland = prev.callPackage ./nix/default.nix {
|
hyprland = prev.callPackage ./nix/default.nix {
|
||||||
stdenv = prev.gcc12Stdenv;
|
stdenv = prev.gcc12Stdenv;
|
||||||
version = "0.14.0beta" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
version = "0.15.0beta" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||||
wlroots = wlroots-hyprland;
|
wlroots = wlroots-hyprland;
|
||||||
};
|
};
|
||||||
hyprland-debug = hyprland.override {debug = true;};
|
hyprland-debug = hyprland.override {debug = true;};
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
project('Hyprland', 'cpp', 'c',
|
project('Hyprland', 'cpp', 'c',
|
||||||
version : '0.14.0beta',
|
version : '0.15.0beta',
|
||||||
default_options : [
|
default_options : [
|
||||||
'warning_level=2',
|
'warning_level=2',
|
||||||
'default_library=static',
|
'default_library=static',
|
||||||
|
@@ -240,10 +240,8 @@ void CCompositor::cleanup() {
|
|||||||
|
|
||||||
// accumulate all PIDs for killing, also request closing.
|
// accumulate all PIDs for killing, also request closing.
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_bIsMapped || !w->m_bIsX11)
|
if (w->m_bIsMapped && !w->m_bHidden)
|
||||||
m_dProcessPIDsOnShutdown.push_back(w->getPID());
|
m_dProcessPIDsOnShutdown.push_back(w->getPID());
|
||||||
|
|
||||||
closeWindow(w.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// end threads
|
// end threads
|
||||||
@@ -252,6 +250,8 @@ void CCompositor::cleanup() {
|
|||||||
m_vWorkspaces.clear();
|
m_vWorkspaces.clear();
|
||||||
m_vWindows.clear();
|
m_vWindows.clear();
|
||||||
|
|
||||||
|
m_bIsShuttingDown = true;
|
||||||
|
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
g_pHyprOpenGL->destroyMonitorResources(m.get());
|
g_pHyprOpenGL->destroyMonitorResources(m.get());
|
||||||
|
|
||||||
@@ -259,6 +259,8 @@ void CCompositor::cleanup() {
|
|||||||
wlr_output_commit(m->output);
|
wlr_output_commit(m->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_vMonitors.clear();
|
||||||
|
|
||||||
if (g_pXWaylandManager->m_sWLRXWayland) {
|
if (g_pXWaylandManager->m_sWLRXWayland) {
|
||||||
wlr_xwayland_destroy(g_pXWaylandManager->m_sWLRXWayland);
|
wlr_xwayland_destroy(g_pXWaylandManager->m_sWLRXWayland);
|
||||||
g_pXWaylandManager->m_sWLRXWayland = nullptr;
|
g_pXWaylandManager->m_sWLRXWayland = nullptr;
|
||||||
@@ -266,8 +268,6 @@ void CCompositor::cleanup() {
|
|||||||
|
|
||||||
wl_display_terminate(m_sWLDisplay);
|
wl_display_terminate(m_sWLDisplay);
|
||||||
|
|
||||||
m_bIsShuttingDown = true;
|
|
||||||
|
|
||||||
g_pKeybindManager->spawn("sleep 5 && kill -9 " + std::to_string(m_iHyprlandPID)); // this is to prevent that random "freezing"
|
g_pKeybindManager->spawn("sleep 5 && kill -9 " + std::to_string(m_iHyprlandPID)); // this is to prevent that random "freezing"
|
||||||
// the PID should not be reused.
|
// the PID should not be reused.
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ struct SWindowAdditionalConfigData {
|
|||||||
bool forceNoBlur = false;
|
bool forceNoBlur = false;
|
||||||
bool forceOpaque = false;
|
bool forceOpaque = false;
|
||||||
bool forceAllowsInput = false;
|
bool forceAllowsInput = false;
|
||||||
|
bool forceNoAnims = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWindow {
|
class CWindow {
|
||||||
|
@@ -125,6 +125,7 @@ void CConfigManager::setDefaultVars() {
|
|||||||
configValues["animations:workspaces"].intValue = 1;
|
configValues["animations:workspaces"].intValue = 1;
|
||||||
|
|
||||||
configValues["input:sensitivity"].floatValue = 0.f;
|
configValues["input:sensitivity"].floatValue = 0.f;
|
||||||
|
configValues["input:accel_profile"].strValue = STRVAL_EMPTY;
|
||||||
configValues["input:kb_file"].strValue = STRVAL_EMPTY;
|
configValues["input:kb_file"].strValue = STRVAL_EMPTY;
|
||||||
configValues["input:kb_layout"].strValue = "us";
|
configValues["input:kb_layout"].strValue = "us";
|
||||||
configValues["input:kb_variant"].strValue = STRVAL_EMPTY;
|
configValues["input:kb_variant"].strValue = STRVAL_EMPTY;
|
||||||
@@ -137,12 +138,15 @@ void CConfigManager::setDefaultVars() {
|
|||||||
configValues["input:numlock_by_default"].intValue = 0;
|
configValues["input:numlock_by_default"].intValue = 0;
|
||||||
configValues["input:force_no_accel"].intValue = 0;
|
configValues["input:force_no_accel"].intValue = 0;
|
||||||
configValues["input:float_switch_override_focus"].intValue = 1;
|
configValues["input:float_switch_override_focus"].intValue = 1;
|
||||||
|
configValues["input:left_handed"].intValue = 0;
|
||||||
|
configValues["input:scroll_method"].strValue = STRVAL_EMPTY;
|
||||||
configValues["input:touchpad:natural_scroll"].intValue = 0;
|
configValues["input:touchpad:natural_scroll"].intValue = 0;
|
||||||
configValues["input:touchpad:disable_while_typing"].intValue = 1;
|
configValues["input:touchpad:disable_while_typing"].intValue = 1;
|
||||||
configValues["input:touchpad:clickfinger_behavior"].intValue = 0;
|
configValues["input:touchpad:clickfinger_behavior"].intValue = 0;
|
||||||
configValues["input:touchpad:middle_button_emulation"].intValue = 0;
|
configValues["input:touchpad:middle_button_emulation"].intValue = 0;
|
||||||
configValues["input:touchpad:tap-to-click"].intValue = 1;
|
configValues["input:touchpad:tap-to-click"].intValue = 1;
|
||||||
configValues["input:touchpad:drag_lock"].intValue = 0;
|
configValues["input:touchpad:drag_lock"].intValue = 0;
|
||||||
|
configValues["input:touchpad:scroll_factor"].floatValue = 1.f;
|
||||||
|
|
||||||
configValues["binds:pass_mouse_when_bound"].intValue = 0;
|
configValues["binds:pass_mouse_when_bound"].intValue = 0;
|
||||||
configValues["binds:scroll_event_delay"].intValue = 300;
|
configValues["binds:scroll_event_delay"].intValue = 300;
|
||||||
@@ -165,6 +169,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
|
|||||||
auto& cfgValues = deviceConfigs[dev];
|
auto& cfgValues = deviceConfigs[dev];
|
||||||
|
|
||||||
cfgValues["sensitivity"].floatValue = 0.f;
|
cfgValues["sensitivity"].floatValue = 0.f;
|
||||||
|
cfgValues["accel_profile"].strValue = STRVAL_EMPTY;
|
||||||
cfgValues["kb_file"].strValue = STRVAL_EMPTY;
|
cfgValues["kb_file"].strValue = STRVAL_EMPTY;
|
||||||
cfgValues["kb_layout"].strValue = "us";
|
cfgValues["kb_layout"].strValue = "us";
|
||||||
cfgValues["kb_variant"].strValue = STRVAL_EMPTY;
|
cfgValues["kb_variant"].strValue = STRVAL_EMPTY;
|
||||||
@@ -180,6 +185,8 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
|
|||||||
cfgValues["middle_button_emulation"].intValue = 0;
|
cfgValues["middle_button_emulation"].intValue = 0;
|
||||||
cfgValues["tap-to-click"].intValue = 1;
|
cfgValues["tap-to-click"].intValue = 1;
|
||||||
cfgValues["drag_lock"].intValue = 0;
|
cfgValues["drag_lock"].intValue = 0;
|
||||||
|
cfgValues["left_handed"].intValue = 0;
|
||||||
|
cfgValues["scroll_method"].strValue = STRVAL_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::setDefaultAnimationVars() {
|
void CConfigManager::setDefaultAnimationVars() {
|
||||||
@@ -373,6 +380,11 @@ void CConfigManager::handleRawExec(const std::string& command, const std::string
|
|||||||
if (child == 0) {
|
if (child == 0) {
|
||||||
// run in child
|
// run in child
|
||||||
grandchild = fork();
|
grandchild = fork();
|
||||||
|
|
||||||
|
sigset_t set;
|
||||||
|
sigemptyset(&set);
|
||||||
|
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||||
|
|
||||||
if (grandchild == 0) {
|
if (grandchild == 0) {
|
||||||
// run in grandchild
|
// run in grandchild
|
||||||
close(socket[0]);
|
close(socket[0]);
|
||||||
@@ -705,6 +717,7 @@ bool windowRuleValid(const std::string& RULE) {
|
|||||||
&& RULE.find("opacity") != 0
|
&& RULE.find("opacity") != 0
|
||||||
&& RULE.find("move") != 0
|
&& RULE.find("move") != 0
|
||||||
&& RULE.find("size") != 0
|
&& RULE.find("size") != 0
|
||||||
|
&& RULE.find("minsize") != 0
|
||||||
&& RULE.find("pseudo") != 0
|
&& RULE.find("pseudo") != 0
|
||||||
&& RULE.find("monitor") != 0
|
&& RULE.find("monitor") != 0
|
||||||
&& RULE != "nofocus"
|
&& RULE != "nofocus"
|
||||||
@@ -714,6 +727,7 @@ bool windowRuleValid(const std::string& RULE) {
|
|||||||
&& RULE != "forceinput"
|
&& RULE != "forceinput"
|
||||||
&& RULE != "fullscreen"
|
&& RULE != "fullscreen"
|
||||||
&& RULE != "pin"
|
&& RULE != "pin"
|
||||||
|
&& RULE != "noanim"
|
||||||
&& RULE.find("animation") != 0
|
&& RULE.find("animation") != 0
|
||||||
&& RULE.find("rounding") != 0
|
&& RULE.find("rounding") != 0
|
||||||
&& RULE.find("workspace") != 0);
|
&& RULE.find("workspace") != 0);
|
||||||
@@ -1124,7 +1138,7 @@ void CConfigManager::loadConfigLoadVars() {
|
|||||||
// Update the keyboard layout to the cfg'd one if this is not the first launch
|
// Update the keyboard layout to the cfg'd one if this is not the first launch
|
||||||
if (!isFirstLaunch) {
|
if (!isFirstLaunch) {
|
||||||
g_pInputManager->setKeyboardLayout();
|
g_pInputManager->setKeyboardLayout();
|
||||||
g_pInputManager->setMouseConfigs();
|
g_pInputManager->setPointerConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the internal vars
|
// Calculate the internal vars
|
||||||
@@ -1294,11 +1308,11 @@ void CConfigManager::setString(std::string v, std::string val) {
|
|||||||
configValues[v].strValue = val;
|
configValues[v].strValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitorRule CConfigManager::getMonitorRuleFor(std::string name) {
|
SMonitorRule CConfigManager::getMonitorRuleFor(std::string name, std::string displayName) {
|
||||||
SMonitorRule* found = nullptr;
|
SMonitorRule* found = nullptr;
|
||||||
|
|
||||||
for (auto& r : m_dMonitorRules) {
|
for (auto& r : m_dMonitorRules) {
|
||||||
if (r.name == name) {
|
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;
|
||||||
}
|
}
|
||||||
@@ -1409,7 +1423,7 @@ void CConfigManager::dispatchExecOnce() {
|
|||||||
|
|
||||||
// set input, fixes some certain issues
|
// set input, fixes some certain issues
|
||||||
g_pInputManager->setKeyboardLayout();
|
g_pInputManager->setKeyboardLayout();
|
||||||
g_pInputManager->setMouseConfigs();
|
g_pInputManager->setPointerConfigs();
|
||||||
|
|
||||||
// set ws names again
|
// set ws names again
|
||||||
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
@@ -1422,7 +1436,7 @@ void CConfigManager::performMonitorReload() {
|
|||||||
bool overAgain = false;
|
bool overAgain = false;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||||
auto rule = getMonitorRuleFor(m->szName);
|
auto rule = getMonitorRuleFor(m->szName, m->output->description ? m->output->description : "");
|
||||||
|
|
||||||
// ensure mirror
|
// ensure mirror
|
||||||
m->setMirror(rule.mirrorOf);
|
m->setMirror(rule.mirrorOf);
|
||||||
@@ -1475,7 +1489,7 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
|||||||
|
|
||||||
void CConfigManager::ensureDPMS() {
|
void CConfigManager::ensureDPMS() {
|
||||||
for (auto& rm : g_pCompositor->m_vRealMonitors) {
|
for (auto& rm : g_pCompositor->m_vRealMonitors) {
|
||||||
auto rule = getMonitorRuleFor(rm->szName);
|
auto rule = getMonitorRuleFor(rm->szName, rm->output->description ? rm->output->description : "");
|
||||||
|
|
||||||
if (rule.disabled == rm->m_bEnabled) {
|
if (rule.disabled == rm->m_bEnabled) {
|
||||||
rm->m_pThisWrap = &rm;
|
rm->m_pThisWrap = &rm;
|
||||||
|
@@ -135,7 +135,7 @@ public:
|
|||||||
SConfigValue* getConfigValuePtr(std::string);
|
SConfigValue* getConfigValuePtr(std::string);
|
||||||
SConfigValue* getConfigValuePtrSafe(std::string);
|
SConfigValue* getConfigValuePtrSafe(std::string);
|
||||||
|
|
||||||
SMonitorRule getMonitorRuleFor(std::string);
|
SMonitorRule getMonitorRuleFor(std::string, std::string displayName = "");
|
||||||
|
|
||||||
CMonitor* getBoundMonitorForWS(std::string);
|
CMonitor* getBoundMonitorForWS(std::string);
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
|||||||
R"#({
|
R"#({
|
||||||
"id": %i,
|
"id": %i,
|
||||||
"name": "%s",
|
"name": "%s",
|
||||||
|
"description": "%s",
|
||||||
"width": %i,
|
"width": %i,
|
||||||
"height": %i,
|
"height": %i,
|
||||||
"refreshRate": %f,
|
"refreshRate": %f,
|
||||||
@@ -35,10 +36,12 @@ R"#({
|
|||||||
"reserved": [%i, %i, %i, %i],
|
"reserved": [%i, %i, %i, %i],
|
||||||
"scale": %.2f,
|
"scale": %.2f,
|
||||||
"transform": %i,
|
"transform": %i,
|
||||||
"focused": %s
|
"focused": %s,
|
||||||
|
"dpmsStatus": %s
|
||||||
},)#",
|
},)#",
|
||||||
m->ID,
|
m->ID,
|
||||||
escapeJSONStrings(m->szName).c_str(),
|
escapeJSONStrings(m->szName).c_str(),
|
||||||
|
escapeJSONStrings(m->output->description ? m->output->description : "").c_str(),
|
||||||
(int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
|
(int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
|
||||||
m->refreshRate,
|
m->refreshRate,
|
||||||
(int)m->vecPosition.x, (int)m->vecPosition.y,
|
(int)m->vecPosition.x, (int)m->vecPosition.y,
|
||||||
@@ -46,7 +49,8 @@ R"#({
|
|||||||
(int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y,
|
(int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y,
|
||||||
m->scale,
|
m->scale,
|
||||||
(int)m->transform,
|
(int)m->transform,
|
||||||
(m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false")
|
(m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"),
|
||||||
|
(m->dpmsStatus ? "true" : "false")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +60,8 @@ 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\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: %i\n\tfocused: %s\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: %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->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"));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,8 +95,8 @@ R"#({
|
|||||||
"fullscreenMode": %i
|
"fullscreenMode": %i
|
||||||
},)#",
|
},)#",
|
||||||
w.get(),
|
w.get(),
|
||||||
(int)w->m_vRealPosition.vec().x, (int)w->m_vRealPosition.vec().y,
|
(int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y,
|
||||||
(int)w->m_vRealSize.vec().x, (int)w->m_vRealSize.vec().y,
|
(int)w->m_vRealSize.goalv().x, (int)w->m_vRealSize.goalv().y,
|
||||||
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(),
|
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(),
|
||||||
((int)w->m_bIsFloating == 1 ? "true" : "false"),
|
((int)w->m_bIsFloating == 1 ? "true" : "false"),
|
||||||
w->m_iMonitorID,
|
w->m_iMonitorID,
|
||||||
@@ -116,7 +120,7 @@ R"#({
|
|||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped) {
|
if (w->m_bIsMapped) {
|
||||||
result += 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\n",
|
result += 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\n",
|
||||||
w.get(), w->m_szTitle.c_str(), (int)w->m_vRealPosition.vec().x, (int)w->m_vRealPosition.vec().y, (int)w->m_vRealSize.vec().x, (int)w->m_vRealSize.vec().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.get()).c_str(), g_pXWaylandManager->getTitle(w.get()).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));
|
w.get(), 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.get()).c_str(), g_pXWaylandManager->getTitle(w.get()).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));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,6 +406,24 @@ R"#( {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove trailing comma
|
||||||
|
if (result[result.size() - 1] == ',')
|
||||||
|
result.pop_back();
|
||||||
|
result += "\n],\n";
|
||||||
|
|
||||||
|
result += "\"switches\": [\n";
|
||||||
|
|
||||||
|
for (auto& d : g_pInputManager->m_lSwitches) {
|
||||||
|
result += getFormat(
|
||||||
|
R"#( {
|
||||||
|
"address": "0x%x",
|
||||||
|
"name": "%s"
|
||||||
|
},)#",
|
||||||
|
&d,
|
||||||
|
d.pWlrDevice ? d.pWlrDevice->name : ""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// remove trailing comma
|
// remove trailing comma
|
||||||
if (result[result.size() - 1] == ',')
|
if (result[result.size() - 1] == ',')
|
||||||
result.pop_back();
|
result.pop_back();
|
||||||
@@ -442,6 +464,12 @@ R"#( {
|
|||||||
for (auto& d : g_pInputManager->m_lTouchDevices) {
|
for (auto& d : g_pInputManager->m_lTouchDevices) {
|
||||||
result += getFormat("\tTouch Device at %x:\n\t\t%s\n", &d, d.pWlrDevice ? d.pWlrDevice->name : "");
|
result += getFormat("\tTouch Device at %x:\n\t\t%s\n", &d, d.pWlrDevice ? d.pWlrDevice->name : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result += "\n\nSwitches:\n";
|
||||||
|
|
||||||
|
for (auto& d : g_pInputManager->m_lSwitches) {
|
||||||
|
result += getFormat("\tSwitch Device at %x:\n\t\t%s\n", &d, d.pWlrDevice ? d.pWlrDevice->name : "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -533,7 +561,7 @@ std::string dispatchKeyword(std::string in) {
|
|||||||
|
|
||||||
if (COMMAND.contains("input") || COMMAND.contains("device:")) {
|
if (COMMAND.contains("input") || COMMAND.contains("device:")) {
|
||||||
g_pInputManager->setKeyboardLayout(); // update kb layout
|
g_pInputManager->setKeyboardLayout(); // update kb layout
|
||||||
g_pInputManager->setMouseConfigs(); // update mouse cfgs
|
g_pInputManager->setPointerConfigs(); // update mouse cfgs
|
||||||
}
|
}
|
||||||
|
|
||||||
if (COMMAND.contains("general:layout"))
|
if (COMMAND.contains("general:layout"))
|
||||||
|
@@ -82,6 +82,10 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
|
|||||||
Debug::log(LOG, "Attached a tablet pad with name %s", DEVICE->name);
|
Debug::log(LOG, "Attached a tablet pad with name %s", DEVICE->name);
|
||||||
g_pInputManager->newTabletPad(DEVICE);
|
g_pInputManager->newTabletPad(DEVICE);
|
||||||
break;
|
break;
|
||||||
|
case WLR_INPUT_DEVICE_SWITCH:
|
||||||
|
Debug::log(LOG, "Attached a switch device with name %s", DEVICE->name);
|
||||||
|
g_pInputManager->newSwitch(DEVICE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name);
|
Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name);
|
||||||
break;
|
break;
|
||||||
|
@@ -152,6 +152,8 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
|
|||||||
layersurface->alpha = 255.f;
|
layersurface->alpha = 255.f;
|
||||||
layersurface->readyToDelete = false;
|
layersurface->readyToDelete = false;
|
||||||
layersurface->fadingOut = false;
|
layersurface->fadingOut = false;
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
||||||
@@ -159,6 +161,8 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||||||
|
|
||||||
Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface);
|
Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface);
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
|
||||||
|
|
||||||
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID) || g_pCompositor->m_bUnsafeState) {
|
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID) || g_pCompositor->m_bUnsafeState) {
|
||||||
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
|
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
|
||||||
|
|
||||||
|
@@ -32,8 +32,8 @@ void addPopupGlobalCoords(void* pPopup, int* x, int* y) {
|
|||||||
py -= curPopup->popup->base->current.geometry.y;
|
py -= curPopup->popup->base->current.geometry.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curPopup->pSurfaceTree && curPopup->pSurfaceTree->pSurface && !curPopup->parentPopup && !curPopup->parentWindow) {
|
if (curPopup->popup && !curPopup->parentPopup && !curPopup->parentWindow) {
|
||||||
const auto EXTENTSSURFACE = pixman_region32_extents(&curPopup->pSurfaceTree->pSurface->input_region);
|
const auto EXTENTSSURFACE = pixman_region32_extents(&curPopup->popup->base->surface->input_region);
|
||||||
px -= EXTENTSSURFACE->x1;
|
px -= EXTENTSSURFACE->x1;
|
||||||
py -= EXTENTSSURFACE->y1;
|
py -= EXTENTSSURFACE->y1;
|
||||||
}
|
}
|
||||||
|
@@ -166,6 +166,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
PWINDOW->m_sAdditionalConfigData.forceAllowsInput = true;
|
PWINDOW->m_sAdditionalConfigData.forceAllowsInput = true;
|
||||||
} else if (r.szRule == "pin") {
|
} else if (r.szRule == "pin") {
|
||||||
PWINDOW->m_bPinned = true;
|
PWINDOW->m_bPinned = true;
|
||||||
|
} else if (r.szRule == "noanim") {
|
||||||
|
PWINDOW->m_sAdditionalConfigData.forceNoAnims = true;
|
||||||
} else if (r.szRule.find("rounding") == 0) {
|
} else if (r.szRule.find("rounding") == 0) {
|
||||||
try {
|
try {
|
||||||
PWINDOW->m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
PWINDOW->m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
||||||
@@ -249,6 +251,21 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
} 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) {
|
||||||
|
try {
|
||||||
|
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
||||||
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(" "));
|
||||||
|
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));
|
||||||
|
|
||||||
|
PWINDOW->m_vRealSize = SIZE;
|
||||||
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
||||||
|
|
||||||
|
PWINDOW->m_bHidden = false;
|
||||||
|
} catch (...) {
|
||||||
|
Debug::log(LOG, "Rule minsize 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 {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
||||||
@@ -380,39 +397,59 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
|
|
||||||
// verify swallowing
|
// verify swallowing
|
||||||
if (*PSWALLOW) {
|
if (*PSWALLOW) {
|
||||||
|
// don't swallow ourselves
|
||||||
|
std::regex rgx(*PSWALLOWREGEX);
|
||||||
|
if (!std::regex_match(g_pXWaylandManager->getAppIDClass(PWINDOW), rgx)) {
|
||||||
// check parent
|
// check parent
|
||||||
int ppid = getPPIDof(PWINDOW->getPID());
|
int ppid = getPPIDof(PWINDOW->getPID());
|
||||||
|
|
||||||
const auto PPPID = getPPIDof(ppid);
|
int curppid = 0;
|
||||||
|
|
||||||
// why? no clue. Blame terminals.
|
for (int i = 0; i < 5; ++i) {
|
||||||
if (PPPID > 2) {
|
curppid = getPPIDof(ppid);
|
||||||
ppid = PPPID;
|
|
||||||
|
if (curppid < 10) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ppid = curppid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppid) {
|
if (ppid) {
|
||||||
// get window by pid
|
// get window by pid
|
||||||
CWindow* found = nullptr;
|
std::vector<CWindow*> found;
|
||||||
|
CWindow* finalFound = nullptr;
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bHidden)
|
if (!w->m_bIsMapped || w->m_bHidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->getPID() == ppid) {
|
if (w->getPID() == ppid) {
|
||||||
found = w.get();
|
found.push_back(w.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found.size() > 1) {
|
||||||
|
for (auto& w : found) {
|
||||||
|
// try get the focus, otherwise we'll ignore to avoid swallowing incorrect windows
|
||||||
|
if (w == PFOCUSEDWINDOWPREV) {
|
||||||
|
finalFound = w;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (found.size() == 1) {
|
||||||
|
finalFound = found[0];
|
||||||
|
}
|
||||||
|
|
||||||
if (found) {
|
if (finalFound) {
|
||||||
// check if it's the window we want
|
// check if it's the window we want
|
||||||
std::regex rgx(*PSWALLOWREGEX);
|
if (std::regex_match(g_pXWaylandManager->getAppIDClass(finalFound), rgx)) {
|
||||||
if (std::regex_match(g_pXWaylandManager->getAppIDClass(found), rgx)) {
|
|
||||||
// swallow
|
// swallow
|
||||||
PWINDOW->m_pSwallowed = found;
|
PWINDOW->m_pSwallowed = finalFound;
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(found);
|
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(finalFound);
|
||||||
|
|
||||||
found->m_bHidden = true;
|
finalFound->m_bHidden = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -332,6 +332,15 @@ void logSystemInfo() {
|
|||||||
Debug::log(LOG, "Release: %s", unameInfo.release);
|
Debug::log(LOG, "Release: %s", unameInfo.release);
|
||||||
Debug::log(LOG, "Version: %s", unameInfo.version);
|
Debug::log(LOG, "Version: %s", unameInfo.version);
|
||||||
|
|
||||||
|
Debug::log(NONE, "\n");
|
||||||
|
|
||||||
|
const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA");
|
||||||
|
Debug::log(LOG, "GPU information:\n%s\n", GPUINFO.c_str());
|
||||||
|
|
||||||
|
if (GPUINFO.contains("NVIDIA")) {
|
||||||
|
Debug::log(WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
|
||||||
|
}
|
||||||
|
|
||||||
// log etc
|
// log etc
|
||||||
Debug::log(LOG, "os-release:");
|
Debug::log(LOG, "os-release:");
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
szName = output->name;
|
szName = output->name;
|
||||||
|
|
||||||
// get monitor rule that matches
|
// get monitor rule that matches
|
||||||
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name);
|
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name, output->description ? output->description : "");
|
||||||
|
|
||||||
hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this);
|
hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this);
|
||||||
hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
|
hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
|
||||||
@@ -140,7 +140,7 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
|
|
||||||
void CMonitor::onDisconnect() {
|
void CMonitor::onDisconnect() {
|
||||||
|
|
||||||
if (!m_bEnabled)
|
if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Cleanup everything. Move windows back, snap cursor, shit.
|
// Cleanup everything. Move windows back, snap cursor, shit.
|
||||||
@@ -297,7 +297,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
|||||||
pMirrorOf = nullptr;
|
pMirrorOf = nullptr;
|
||||||
|
|
||||||
// set rule
|
// set rule
|
||||||
const auto RULE = g_pConfigManager->getMonitorRuleFor(this->szName);
|
const auto RULE = g_pConfigManager->getMonitorRuleFor(this->szName, this->output->description ? this->output->description : "");
|
||||||
|
|
||||||
vecPosition = RULE.offset;
|
vecPosition = RULE.offset;
|
||||||
|
|
||||||
|
@@ -37,6 +37,8 @@ public:
|
|||||||
bool scheduledRecalc = false;
|
bool scheduledRecalc = false;
|
||||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||||
|
|
||||||
|
bool dpmsStatus = true;
|
||||||
|
|
||||||
// mirroring
|
// mirroring
|
||||||
CMonitor* pMirrorOf = nullptr;
|
CMonitor* pMirrorOf = nullptr;
|
||||||
std::vector<CMonitor*> mirrors;
|
std::vector<CMonitor*> mirrors;
|
||||||
|
@@ -178,6 +178,9 @@ 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; });
|
||||||
|
|
||||||
|
if (IT != SubsurfaceTree::surfaceTreeNodes.end()) {
|
||||||
int lx = 0, ly = 0;
|
int lx = 0, ly = 0;
|
||||||
addSurfaceGlobalOffset(PNODE, &lx, &ly);
|
addSurfaceGlobalOffset(PNODE, &lx, &ly);
|
||||||
|
|
||||||
@@ -193,6 +196,7 @@ void Events::listener_unmapSubsurface(void* owner, void* data) {
|
|||||||
// subsurface->pChild = nullptr;
|
// subsurface->pChild = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Events::listener_commitSubsurface(void* owner, void* data) {
|
void Events::listener_commitSubsurface(void* owner, void* data) {
|
||||||
SSurfaceTreeNode* pNode = (SSurfaceTreeNode*)owner;
|
SSurfaceTreeNode* pNode = (SSurfaceTreeNode*)owner;
|
||||||
|
@@ -332,3 +332,14 @@ struct STouchDevice {
|
|||||||
return pWlrDevice == other.pWlrDevice;
|
return pWlrDevice == other.pWlrDevice;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SSwitchDevice {
|
||||||
|
wlr_input_device* pWlrDevice = nullptr;
|
||||||
|
|
||||||
|
DYNLISTENER(destroy);
|
||||||
|
DYNLISTENER(toggle);
|
||||||
|
|
||||||
|
bool operator==(const SSwitchDevice& other) {
|
||||||
|
return pWlrDevice == other.pWlrDevice;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@@ -101,6 +101,7 @@ extern "C" {
|
|||||||
#include <wlr/types/wlr_input_method_v2.h>
|
#include <wlr/types/wlr_input_method_v2.h>
|
||||||
#include <wlr/types/wlr_text_input_v3.h>
|
#include <wlr/types/wlr_text_input_v3.h>
|
||||||
#include <wlr/types/wlr_touch.h>
|
#include <wlr/types/wlr_touch.h>
|
||||||
|
#include <wlr/types/wlr_switch.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef delete
|
#undef delete
|
||||||
|
@@ -21,12 +21,12 @@ void CAnimationManager::addBezierWithName(std::string name, const Vector2D& p1,
|
|||||||
|
|
||||||
void CAnimationManager::tick() {
|
void CAnimationManager::tick() {
|
||||||
|
|
||||||
bool animationsDisabled = false;
|
bool animGlobalDisabled = false;
|
||||||
|
|
||||||
static auto *const PANIMENABLED = &g_pConfigManager->getConfigValuePtr("animations:enabled")->intValue;
|
static auto *const PANIMENABLED = &g_pConfigManager->getConfigValuePtr("animations:enabled")->intValue;
|
||||||
|
|
||||||
if (!*PANIMENABLED)
|
if (!*PANIMENABLED)
|
||||||
animationsDisabled = true;
|
animGlobalDisabled = true;
|
||||||
|
|
||||||
static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
|
static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
|
||||||
static auto *const PSHADOWSENABLED = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;
|
static auto *const PSHADOWSENABLED = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;
|
||||||
@@ -56,11 +56,13 @@ void CAnimationManager::tick() {
|
|||||||
const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace;
|
const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace;
|
||||||
const auto PLAYER = (SLayerSurface*)av->m_pLayer;
|
const auto PLAYER = (SLayerSurface*)av->m_pLayer;
|
||||||
CMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
bool animationsDisabled = animGlobalDisabled;
|
||||||
|
|
||||||
wlr_box WLRBOXPREV = {0,0,0,0};
|
wlr_box WLRBOXPREV = {0,0,0,0};
|
||||||
if (PWINDOW) {
|
if (PWINDOW) {
|
||||||
WLRBOXPREV = PWINDOW->getFullWindowBoundingBox();
|
WLRBOXPREV = PWINDOW->getFullWindowBoundingBox();
|
||||||
PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||||
|
animationsDisabled = animationsDisabled || PWINDOW->m_sAdditionalConfigData.forceNoAnims;
|
||||||
} else if (PWORKSPACE) {
|
} else if (PWORKSPACE) {
|
||||||
PMONITOR = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID);
|
PMONITOR = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID);
|
||||||
WLRBOXPREV = {(int)PMONITOR->vecPosition.x, (int)PMONITOR->vecPosition.y, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y};
|
WLRBOXPREV = {(int)PMONITOR->vecPosition.x, (int)PMONITOR->vecPosition.y, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y};
|
||||||
|
@@ -202,9 +202,9 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
|
|||||||
m_dPressedKeycodes.push_back(KEYCODE);
|
m_dPressedKeycodes.push_back(KEYCODE);
|
||||||
m_dPressedKeysyms.push_back(keysym);
|
m_dPressedKeysyms.push_back(keysym);
|
||||||
|
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "", keysym, 0, true, e->time_msec) || found;
|
found = handleKeybinds(MODS, "", keysym, 0, true, e->time_msec) || found;
|
||||||
|
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "", 0, KEYCODE, true, e->time_msec) || found;
|
found = handleKeybinds(MODS, "", 0, KEYCODE, true, e->time_msec) || found;
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
shadowKeybinds(keysym, KEYCODE);
|
shadowKeybinds(keysym, KEYCODE);
|
||||||
@@ -219,9 +219,9 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
|
|||||||
m_dPressedKeycodes.erase(std::remove(m_dPressedKeycodes.begin(), m_dPressedKeycodes.end(), KEYCODE), m_dPressedKeycodes.end());
|
m_dPressedKeycodes.erase(std::remove(m_dPressedKeycodes.begin(), m_dPressedKeycodes.end(), KEYCODE), m_dPressedKeycodes.end());
|
||||||
m_dPressedKeysyms.erase(std::remove(m_dPressedKeysyms.begin(), m_dPressedKeysyms.end(), keysym), m_dPressedKeysyms.end());
|
m_dPressedKeysyms.erase(std::remove(m_dPressedKeysyms.begin(), m_dPressedKeysyms.end(), keysym), m_dPressedKeysyms.end());
|
||||||
|
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "", keysym, 0, false, e->time_msec) || found;
|
found = handleKeybinds(MODS, "", keysym, 0, false, e->time_msec) || found;
|
||||||
|
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "", 0, KEYCODE, false, e->time_msec) || found;
|
found = handleKeybinds(MODS, "", 0, KEYCODE, false, e->time_msec) || found;
|
||||||
|
|
||||||
shadowKeybinds();
|
shadowKeybinds();
|
||||||
}
|
}
|
||||||
@@ -244,9 +244,9 @@ bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) {
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
if (e->source == WLR_AXIS_SOURCE_WHEEL && e->orientation == WLR_AXIS_ORIENTATION_VERTICAL) {
|
if (e->source == WLR_AXIS_SOURCE_WHEEL && e->orientation == WLR_AXIS_ORIENTATION_VERTICAL) {
|
||||||
if (e->delta < 0) {
|
if (e->delta < 0) {
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "mouse_down", 0, 0, true, 0);
|
found = handleKeybinds(MODS, "mouse_down", 0, 0, true, 0);
|
||||||
} else {
|
} else {
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "mouse_up", 0, 0, true, 0);
|
found = handleKeybinds(MODS, "mouse_up", 0, 0, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
@@ -268,12 +268,12 @@ bool CKeybindManager::onMouseEvent(wlr_pointer_button_event* e) {
|
|||||||
bool mouseBindWasActive = ensureMouseBindState();
|
bool mouseBindWasActive = ensureMouseBindState();
|
||||||
|
|
||||||
if (e->state == WLR_BUTTON_PRESSED) {
|
if (e->state == WLR_BUTTON_PRESSED) {
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "mouse:" + std::to_string(e->button), 0, 0, true, 0);
|
found = handleKeybinds(MODS, "mouse:" + std::to_string(e->button), 0, 0, true, 0);
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
shadowKeybinds();
|
shadowKeybinds();
|
||||||
} else {
|
} else {
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "mouse:" + std::to_string(e->button), 0, 0, false, 0);
|
found = handleKeybinds(MODS, "mouse:" + std::to_string(e->button), 0, 0, false, 0);
|
||||||
|
|
||||||
shadowKeybinds();
|
shadowKeybinds();
|
||||||
}
|
}
|
||||||
@@ -281,6 +281,10 @@ bool CKeybindManager::onMouseEvent(wlr_pointer_button_event* e) {
|
|||||||
return !found && !mouseBindWasActive;
|
return !found && !mouseBindWasActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::onSwitchEvent(const std::string& switchName) {
|
||||||
|
handleKeybinds(0, "switch:" + switchName, 0, 0, true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int repeatKeyHandler(void* data) {
|
int repeatKeyHandler(void* data) {
|
||||||
SKeybind** ppActiveKeybind = (SKeybind**)data;
|
SKeybind** ppActiveKeybind = (SKeybind**)data;
|
||||||
|
|
||||||
@@ -419,10 +423,29 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
|
|||||||
if (!(keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12))
|
if (!(keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto PSESSION = wlr_backend_get_session(g_pCompositor->m_sWLRBackend);
|
// beyond this point, return true to not handle anything else.
|
||||||
if (PSESSION) {
|
// we'll avoid printing shit to active windows.
|
||||||
const int TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
|
||||||
wlr_session_change_vt(PSESSION, TTY);
|
if (g_pCompositor->m_sWLRSession) {
|
||||||
|
const unsigned int TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||||
|
|
||||||
|
// vtnr is bugged for some reason.
|
||||||
|
const std::string TTYSTR = execAndGet("head -n 1 /sys/devices/virtual/tty/tty0/active").substr(3);
|
||||||
|
unsigned int ttynum = 0;
|
||||||
|
try {
|
||||||
|
ttynum = std::stoll(TTYSTR);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
; // oops?
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ttynum == TTY)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Debug::log(LOG, "Switching from VT %i to VT %i", ttynum, TTY);
|
||||||
|
|
||||||
|
if (!wlr_session_change_vt(g_pCompositor->m_sWLRSession, TTY))
|
||||||
|
return true; // probably same session
|
||||||
|
|
||||||
g_pCompositor->m_bSessionActive = false;
|
g_pCompositor->m_bSessionActive = false;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
@@ -435,7 +458,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) {
|
bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) {
|
||||||
@@ -480,6 +503,11 @@ void CKeybindManager::spawn(std::string args) {
|
|||||||
}
|
}
|
||||||
if (child == 0) {
|
if (child == 0) {
|
||||||
// run in child
|
// run in child
|
||||||
|
|
||||||
|
sigset_t set;
|
||||||
|
sigemptyset(&set);
|
||||||
|
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||||
|
|
||||||
grandchild = fork();
|
grandchild = fork();
|
||||||
if (grandchild == 0) {
|
if (grandchild == 0) {
|
||||||
// run in grandchild
|
// run in grandchild
|
||||||
@@ -616,7 +644,15 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
|
|
||||||
if (*PBACKANDFORTH && PCURRENTWORKSPACE->m_iID == workspaceToChangeTo && PCURRENTWORKSPACE->m_iPrevWorkspaceID != -1 && !internal) {
|
if (*PBACKANDFORTH && PCURRENTWORKSPACE->m_iID == workspaceToChangeTo && PCURRENTWORKSPACE->m_iPrevWorkspaceID != -1 && !internal) {
|
||||||
|
|
||||||
|
const auto PPREVWORKSPACE = g_pCompositor->getWorkspaceByID(PCURRENTWORKSPACE->m_iPrevWorkspaceID);
|
||||||
|
|
||||||
workspaceToChangeTo = PCURRENTWORKSPACE->m_iPrevWorkspaceID;
|
workspaceToChangeTo = PCURRENTWORKSPACE->m_iPrevWorkspaceID;
|
||||||
|
|
||||||
|
if (PPREVWORKSPACE)
|
||||||
|
workspaceName = PPREVWORKSPACE->m_szName;
|
||||||
|
else
|
||||||
|
workspaceName = std::to_string(workspaceToChangeTo);
|
||||||
|
|
||||||
isSwitchingToPrevious = true;
|
isSwitchingToPrevious = true;
|
||||||
|
|
||||||
// If the previous workspace ID isn't reset, cycles can form when continually going
|
// If the previous workspace ID isn't reset, cycles can form when continually going
|
||||||
@@ -988,7 +1024,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
|
|||||||
Vector2D middle = PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f;
|
Vector2D middle = PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f;
|
||||||
g_pCompositor->warpCursorTo(middle);
|
g_pCompositor->warpCursorTo(middle);
|
||||||
|
|
||||||
if (PWINDOWTOCHANGETO->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) {
|
if (PLASTWINDOW->m_iMonitorID != PWINDOWTOCHANGETO->m_iMonitorID) {
|
||||||
// event
|
// event
|
||||||
const auto PNEWMON = g_pCompositor->getMonitorFromID(PWINDOWTOCHANGETO->m_iMonitorID);
|
const auto PNEWMON = g_pCompositor->getMonitorFromID(PWINDOWTOCHANGETO->m_iMonitorID);
|
||||||
const auto PNEWWS = g_pCompositor->getWorkspaceByID(PNEWMON->activeWorkspace);
|
const auto PNEWWS = g_pCompositor->getWorkspaceByID(PNEWMON->activeWorkspace);
|
||||||
@@ -1324,7 +1360,7 @@ void CKeybindManager::forceRendererReload(std::string args) {
|
|||||||
bool overAgain = false;
|
bool overAgain = false;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
auto rule = g_pConfigManager->getMonitorRuleFor(m->szName);
|
auto rule = g_pConfigManager->getMonitorRuleFor(m->szName, m->output->description ? m->output->description : "");
|
||||||
if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule, true)) {
|
if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule, true)) {
|
||||||
overAgain = true;
|
overAgain = true;
|
||||||
break;
|
break;
|
||||||
@@ -1560,11 +1596,22 @@ void CKeybindManager::toggleOpaque(std::string unused) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::dpms(std::string arg) {
|
void CKeybindManager::dpms(std::string arg) {
|
||||||
bool enable = arg == "on";
|
bool enable = arg.find("on") == 0;
|
||||||
|
std::string port = "";
|
||||||
|
|
||||||
|
if (arg.find_first_of(' ') != std::string::npos) {
|
||||||
|
port = arg.substr(arg.find_first_of(' ') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
|
||||||
|
if (!port.empty() && m->szName != port)
|
||||||
|
continue;
|
||||||
|
|
||||||
wlr_output_enable(m->output, enable);
|
wlr_output_enable(m->output, enable);
|
||||||
|
|
||||||
|
m->dpmsStatus = enable;
|
||||||
|
|
||||||
if (!wlr_output_commit(m->output)) {
|
if (!wlr_output_commit(m->output)) {
|
||||||
Debug::log(ERR, "Couldn't commit output %s", m->szName.c_str());
|
Debug::log(ERR, "Couldn't commit output %s", m->szName.c_str());
|
||||||
}
|
}
|
||||||
@@ -1640,7 +1687,7 @@ void CKeybindManager::mouse(std::string args) {
|
|||||||
if (PRESSED) {
|
if (PRESSED) {
|
||||||
g_pKeybindManager->m_bIsMouseBindActive = true;
|
g_pKeybindManager->m_bIsMouseBindActive = true;
|
||||||
|
|
||||||
g_pInputManager->currentlyDraggedWindow = g_pCompositor->windowFromCursor();
|
g_pInputManager->currentlyDraggedWindow = g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal());
|
||||||
g_pInputManager->dragMode = MBIND_MOVE;
|
g_pInputManager->dragMode = MBIND_MOVE;
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onBeginDragWindow();
|
g_pLayoutManager->getCurrentLayout()->onBeginDragWindow();
|
||||||
@@ -1657,7 +1704,7 @@ void CKeybindManager::mouse(std::string args) {
|
|||||||
if (PRESSED) {
|
if (PRESSED) {
|
||||||
g_pKeybindManager->m_bIsMouseBindActive = true;
|
g_pKeybindManager->m_bIsMouseBindActive = true;
|
||||||
|
|
||||||
g_pInputManager->currentlyDraggedWindow = g_pCompositor->windowFromCursor();
|
g_pInputManager->currentlyDraggedWindow = g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal());
|
||||||
g_pInputManager->dragMode = MBIND_RESIZE;
|
g_pInputManager->dragMode = MBIND_RESIZE;
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onBeginDragWindow();
|
g_pLayoutManager->getCurrentLayout()->onBeginDragWindow();
|
||||||
|
@@ -38,6 +38,7 @@ public:
|
|||||||
bool onKeyEvent(wlr_keyboard_key_event*, SKeyboard*);
|
bool onKeyEvent(wlr_keyboard_key_event*, SKeyboard*);
|
||||||
bool onAxisEvent(wlr_pointer_axis_event*);
|
bool onAxisEvent(wlr_pointer_axis_event*);
|
||||||
bool onMouseEvent(wlr_pointer_button_event*);
|
bool onMouseEvent(wlr_pointer_button_event*);
|
||||||
|
void onSwitchEvent(const std::string&);
|
||||||
|
|
||||||
void addKeybind(SKeybind);
|
void addKeybind(SKeybind);
|
||||||
void removeKeybind(uint32_t, const std::string&);
|
void removeKeybind(uint32_t, const std::string&);
|
||||||
|
@@ -435,12 +435,17 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
|
void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
|
||||||
|
static auto *const PSCROLLFACTOR = &g_pConfigManager->getConfigValuePtr("input:touchpad:scroll_factor")->floatValue;
|
||||||
|
|
||||||
|
auto factor = (*PSCROLLFACTOR <= 0.f || e->source != WLR_AXIS_SOURCE_FINGER ? 1.f : *PSCROLLFACTOR);
|
||||||
|
|
||||||
bool passEvent = g_pKeybindManager->onAxisEvent(e);
|
bool passEvent = g_pKeybindManager->onAxisEvent(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, e->delta, e->delta_discrete, e->source);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +667,7 @@ void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
|
|||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
setMouseConfigs();
|
setPointerConfigs();
|
||||||
|
|
||||||
PMOUSE->hyprListener_destroyMouse.initCallback(&mouse->events.destroy, &Events::listener_destroyMouse, PMOUSE, "Mouse");
|
PMOUSE->hyprListener_destroyMouse.initCallback(&mouse->events.destroy, &Events::listener_destroyMouse, PMOUSE, "Mouse");
|
||||||
|
|
||||||
@@ -675,11 +680,11 @@ void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
|
|||||||
Debug::log(LOG, "New mouse created, pointer WLR: %x", mouse);
|
Debug::log(LOG, "New mouse created, pointer WLR: %x", mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setMouseConfigs() {
|
void CInputManager::setPointerConfigs() {
|
||||||
for (auto& m : m_lMice) {
|
for (auto& m : m_lMice) {
|
||||||
const auto PMOUSE = &m;
|
const auto PPOINTER = &m;
|
||||||
|
|
||||||
auto devname = PMOUSE->name;
|
auto devname = PPOINTER->name;
|
||||||
transform(devname.begin(), devname.end(), devname.begin(), ::tolower);
|
transform(devname.begin(), devname.end(), devname.begin(), ::tolower);
|
||||||
|
|
||||||
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
||||||
@@ -692,6 +697,11 @@ void CInputManager::setMouseConfigs() {
|
|||||||
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);
|
||||||
|
|
||||||
|
if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "left_handed") : g_pConfigManager->getInt("input:left_handed")) == 0)
|
||||||
|
libinput_device_config_left_handed_set(LIBINPUTDEV, 0);
|
||||||
|
else
|
||||||
|
libinput_device_config_left_handed_set(LIBINPUTDEV, 1);
|
||||||
|
|
||||||
if (libinput_device_config_middle_emulation_is_available(LIBINPUTDEV)) { // middleclick on r+l mouse button pressed
|
if (libinput_device_config_middle_emulation_is_available(LIBINPUTDEV)) { // middleclick on r+l mouse button pressed
|
||||||
if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "middle_button_emulation") : g_pConfigManager->getInt("input:touchpad:middle_button_emulation")) == 1)
|
if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "middle_button_emulation") : g_pConfigManager->getInt("input:touchpad:middle_button_emulation")) == 1)
|
||||||
libinput_device_config_middle_emulation_set_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
|
libinput_device_config_middle_emulation_set_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
|
||||||
@@ -699,6 +709,21 @@ void CInputManager::setMouseConfigs() {
|
|||||||
libinput_device_config_middle_emulation_set_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
|
libinput_device_config_middle_emulation_set_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto SCROLLMETHOD = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "scroll_method") : g_pConfigManager->getString("input:scroll_method");
|
||||||
|
if (SCROLLMETHOD == "" || SCROLLMETHOD == STRVAL_EMPTY) {
|
||||||
|
libinput_device_config_scroll_set_method(LIBINPUTDEV, libinput_device_config_scroll_get_default_method(LIBINPUTDEV));
|
||||||
|
} else if (SCROLLMETHOD == "no_scroll") {
|
||||||
|
libinput_device_config_scroll_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
|
||||||
|
} else if (SCROLLMETHOD == "2fg") {
|
||||||
|
libinput_device_config_scroll_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_SCROLL_2FG);
|
||||||
|
} else if (SCROLLMETHOD == "edge") {
|
||||||
|
libinput_device_config_scroll_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||||
|
} else if (SCROLLMETHOD == "on_button_down") {
|
||||||
|
libinput_device_config_scroll_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
|
||||||
|
} else {
|
||||||
|
Debug::log(WARN, "Scroll method unknown");
|
||||||
|
}
|
||||||
|
|
||||||
if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "drag_lock") : g_pConfigManager->getInt("input:touchpad:drag_lock")) == 0)
|
if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "drag_lock") : g_pConfigManager->getInt("input:touchpad:drag_lock")) == 0)
|
||||||
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
|
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
|
||||||
else
|
else
|
||||||
@@ -723,10 +748,20 @@ void CInputManager::setMouseConfigs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
|
|
||||||
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");
|
||||||
|
|
||||||
|
if (ACCELPROFILE == "" || ACCELPROFILE == STRVAL_EMPTY) {
|
||||||
|
libinput_device_config_accel_set_profile(LIBINPUTDEV, libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
|
||||||
|
} else if (ACCELPROFILE == "adaptive") {
|
||||||
|
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
|
||||||
|
} else if (ACCELPROFILE == "flat") {
|
||||||
|
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
|
||||||
|
} else {
|
||||||
|
Debug::log(WARN, "Unknown acceleration profile, falling back to default");
|
||||||
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Applied config to mouse %s, sens %.2f", m.name.c_str(), LIBINPUTSENS);
|
Debug::log(LOG, "Applied config to mouse %s, sens %.2f", m.name.c_str(), LIBINPUTSENS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1006,3 +1041,29 @@ void CInputManager::destroyTouchDevice(STouchDevice* pDevice) {
|
|||||||
|
|
||||||
m_lTouchDevices.remove(*pDevice);
|
m_lTouchDevices.remove(*pDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInputManager::newSwitch(wlr_input_device* pDevice) {
|
||||||
|
const auto PNEWDEV = &m_lSwitches.emplace_back();
|
||||||
|
PNEWDEV->pWlrDevice = pDevice;
|
||||||
|
|
||||||
|
Debug::log(LOG, "New switch with name \"%s\" added", pDevice->name);
|
||||||
|
|
||||||
|
PNEWDEV->hyprListener_destroy.initCallback(&pDevice->events.destroy, [&](void* owner, void* data) {
|
||||||
|
destroySwitch((SSwitchDevice*)owner);
|
||||||
|
}, PNEWDEV, "SwitchDevice");
|
||||||
|
|
||||||
|
const auto PSWITCH = wlr_switch_from_input_device(pDevice);
|
||||||
|
|
||||||
|
PNEWDEV->hyprListener_toggle.initCallback(&PSWITCH->events.toggle, [&](void* owner, void* data) {
|
||||||
|
const auto PDEVICE = (SSwitchDevice*)owner;
|
||||||
|
const auto NAME = std::string(PDEVICE->pWlrDevice->name);
|
||||||
|
|
||||||
|
Debug::log(LOG, "Switch %s fired, triggering binds.", NAME.c_str());
|
||||||
|
|
||||||
|
g_pKeybindManager->onSwitchEvent(NAME);
|
||||||
|
}, PNEWDEV, "SwitchDevice");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputManager::destroySwitch(SSwitchDevice* pDevice) {
|
||||||
|
m_lSwitches.remove(*pDevice);
|
||||||
|
}
|
||||||
|
@@ -37,9 +37,11 @@ public:
|
|||||||
void newVirtualKeyboard(wlr_input_device*);
|
void newVirtualKeyboard(wlr_input_device*);
|
||||||
void newMouse(wlr_input_device*, bool virt = false);
|
void newMouse(wlr_input_device*, bool virt = false);
|
||||||
void newTouchDevice(wlr_input_device*);
|
void newTouchDevice(wlr_input_device*);
|
||||||
|
void newSwitch(wlr_input_device*);
|
||||||
void destroyTouchDevice(STouchDevice*);
|
void destroyTouchDevice(STouchDevice*);
|
||||||
void destroyKeyboard(SKeyboard*);
|
void destroyKeyboard(SKeyboard*);
|
||||||
void destroyMouse(wlr_input_device*);
|
void destroyMouse(wlr_input_device*);
|
||||||
|
void destroySwitch(SSwitchDevice*);
|
||||||
|
|
||||||
void constrainMouse(SMouse*, wlr_pointer_constraint_v1*);
|
void constrainMouse(SMouse*, wlr_pointer_constraint_v1*);
|
||||||
void recheckConstraint(SMouse*);
|
void recheckConstraint(SMouse*);
|
||||||
@@ -50,7 +52,7 @@ public:
|
|||||||
void refocus();
|
void refocus();
|
||||||
|
|
||||||
void setKeyboardLayout();
|
void setKeyboardLayout();
|
||||||
void setMouseConfigs();
|
void setPointerConfigs();
|
||||||
|
|
||||||
void updateDragIcon();
|
void updateDragIcon();
|
||||||
void updateCapabilities(wlr_input_device*);
|
void updateCapabilities(wlr_input_device*);
|
||||||
@@ -89,6 +91,9 @@ public:
|
|||||||
// Touch devices
|
// Touch devices
|
||||||
std::list<STouchDevice> m_lTouchDevices;
|
std::list<STouchDevice> m_lTouchDevices;
|
||||||
|
|
||||||
|
// Switches
|
||||||
|
std::list<SSwitchDevice> m_lSwitches;
|
||||||
|
|
||||||
void newTabletTool(wlr_input_device*);
|
void newTabletTool(wlr_input_device*);
|
||||||
void newTabletPad(wlr_input_device*);
|
void newTabletPad(wlr_input_device*);
|
||||||
void focusTablet(STablet*, wlr_tablet_tool*, bool motion = false);
|
void focusTablet(STablet*, wlr_tablet_tool*, bool motion = false);
|
||||||
|
@@ -42,6 +42,7 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||||||
static auto *const PSWIPEPERC = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_cancel_ratio")->floatValue;
|
static auto *const PSWIPEPERC = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_cancel_ratio")->floatValue;
|
||||||
static auto *const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue;
|
static auto *const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue;
|
||||||
static auto *const PSWIPEFORC = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_min_speed_to_force")->intValue;
|
static auto *const PSWIPEFORC = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_min_speed_to_force")->intValue;
|
||||||
|
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert";
|
||||||
|
|
||||||
// commit
|
// commit
|
||||||
std::string wsname = "";
|
std::string wsname = "";
|
||||||
@@ -64,9 +65,15 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||||||
} else {
|
} else {
|
||||||
if (m_sActiveSwipe.delta < 0) {
|
if (m_sActiveSwipe.delta < 0) {
|
||||||
// to left
|
// to left
|
||||||
|
if (VERTANIMS)
|
||||||
|
PWORKSPACEL->m_vRenderOffset = Vector2D({0, -m_sActiveSwipe.pMonitor->vecSize.y});
|
||||||
|
else
|
||||||
PWORKSPACEL->m_vRenderOffset = Vector2D({-m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
PWORKSPACEL->m_vRenderOffset = Vector2D({-m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
||||||
} else {
|
} else {
|
||||||
// to right
|
// to right
|
||||||
|
if (VERTANIMS)
|
||||||
|
PWORKSPACER->m_vRenderOffset = Vector2D({0, m_sActiveSwipe.pMonitor->vecSize.y});
|
||||||
|
else
|
||||||
PWORKSPACER->m_vRenderOffset = Vector2D({m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
PWORKSPACER->m_vRenderOffset = Vector2D({m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +91,9 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||||||
PWORKSPACEL->m_fAlpha.setValueAndWarp(255.f);
|
PWORKSPACEL->m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
||||||
|
if (VERTANIMS)
|
||||||
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0, m_sActiveSwipe.pMonitor->vecSize.y);
|
||||||
|
else
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(m_sActiveSwipe.pMonitor->vecSize.x, 0);
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(m_sActiveSwipe.pMonitor->vecSize.x, 0);
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(255.f);
|
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
|
||||||
@@ -102,6 +112,9 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||||||
PWORKSPACER->m_fAlpha.setValueAndWarp(255.f);
|
PWORKSPACER->m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
||||||
|
if (VERTANIMS)
|
||||||
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0, -m_sActiveSwipe.pMonitor->vecSize.y);
|
||||||
|
else
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(-m_sActiveSwipe.pMonitor->vecSize.x, 0);
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(-m_sActiveSwipe.pMonitor->vecSize.x, 0);
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(255.f);
|
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
|
||||||
@@ -135,7 +148,9 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||||||
static auto *const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue;
|
static auto *const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue;
|
||||||
static auto *const PSWIPEINVR = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_invert")->intValue;
|
static auto *const PSWIPEINVR = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_invert")->intValue;
|
||||||
|
|
||||||
m_sActiveSwipe.delta += *PSWIPEINVR ? -e->dx : e->dx;
|
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert";
|
||||||
|
|
||||||
|
m_sActiveSwipe.delta += VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx);
|
||||||
|
|
||||||
m_sActiveSwipe.avgSpeed = (m_sActiveSwipe.avgSpeed * m_sActiveSwipe.speedPoints + abs(e->dx)) / (m_sActiveSwipe.speedPoints + 1);
|
m_sActiveSwipe.avgSpeed = (m_sActiveSwipe.avgSpeed * m_sActiveSwipe.speedPoints + abs(e->dx)) / (m_sActiveSwipe.speedPoints + 1);
|
||||||
m_sActiveSwipe.speedPoints++;
|
m_sActiveSwipe.speedPoints++;
|
||||||
@@ -171,8 +186,13 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||||||
PWORKSPACER->m_fAlpha.setValueAndWarp(0.f);
|
PWORKSPACER->m_fAlpha.setValueAndWarp(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VERTANIMS) {
|
||||||
|
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));
|
||||||
|
} 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));
|
||||||
|
}
|
||||||
|
|
||||||
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDLeft);
|
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDLeft);
|
||||||
} else {
|
} else {
|
||||||
@@ -193,8 +213,13 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||||||
PWORKSPACEL->m_fAlpha.setValueAndWarp(0.f);
|
PWORKSPACEL->m_fAlpha.setValueAndWarp(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VERTANIMS) {
|
||||||
|
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));
|
||||||
|
} 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));
|
||||||
|
}
|
||||||
|
|
||||||
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight);
|
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,10 @@
|
|||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
|
|
||||||
void CInputManager::onTouchDown(wlr_touch_down_event* e) {
|
void CInputManager::onTouchDown(wlr_touch_down_event* e) {
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, g_pCompositor->m_pLastMonitor->vecPosition.x + e->x * g_pCompositor->m_pLastMonitor->vecSize.x, g_pCompositor->m_pLastMonitor->vecPosition.y + e->y * g_pCompositor->m_pLastMonitor->vecSize.y);
|
auto PMONITOR = g_pCompositor->getMonitorFromName(e->touch->output_name ? e->touch->output_name : "");
|
||||||
|
PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_pLastMonitor;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
refocus();
|
refocus();
|
||||||
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
#include "Shaders.hpp"
|
||||||
#include "OpenGL.hpp"
|
#include "OpenGL.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../helpers/MiscFunctions.hpp"
|
#include "../helpers/MiscFunctions.hpp"
|
||||||
@@ -150,9 +151,7 @@ void CHyprOpenGLImpl::initShaders() {
|
|||||||
m_RenderData.pCurrentMonData->m_shQUAD.proj = glGetUniformLocation(prog, "proj");
|
m_RenderData.pCurrentMonData->m_shQUAD.proj = glGetUniformLocation(prog, "proj");
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.color = glGetUniformLocation(prog, "color");
|
m_RenderData.pCurrentMonData->m_shQUAD.color = glGetUniformLocation(prog, "color");
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.posAttrib = glGetAttribLocation(prog, "pos");
|
m_RenderData.pCurrentMonData->m_shQUAD.posAttrib = glGetAttribLocation(prog, "pos");
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.texAttrib = glGetAttribLocation(prog, "texcoord");
|
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.topLeft = glGetUniformLocation(prog, "topLeft");
|
m_RenderData.pCurrentMonData->m_shQUAD.topLeft = glGetUniformLocation(prog, "topLeft");
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.bottomRight = glGetUniformLocation(prog, "bottomRight");
|
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.fullSize = glGetUniformLocation(prog, "fullSize");
|
m_RenderData.pCurrentMonData->m_shQUAD.fullSize = glGetUniformLocation(prog, "fullSize");
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.radius = glGetUniformLocation(prog, "radius");
|
m_RenderData.pCurrentMonData->m_shQUAD.radius = glGetUniformLocation(prog, "radius");
|
||||||
m_RenderData.pCurrentMonData->m_shQUAD.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
m_RenderData.pCurrentMonData->m_shQUAD.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
||||||
@@ -166,7 +165,6 @@ void CHyprOpenGLImpl::initShaders() {
|
|||||||
m_RenderData.pCurrentMonData->m_shRGBA.posAttrib = glGetAttribLocation(prog, "pos");
|
m_RenderData.pCurrentMonData->m_shRGBA.posAttrib = glGetAttribLocation(prog, "pos");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.discardOpaque = glGetUniformLocation(prog, "discardOpaque");
|
m_RenderData.pCurrentMonData->m_shRGBA.discardOpaque = glGetUniformLocation(prog, "discardOpaque");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.topLeft = glGetUniformLocation(prog, "topLeft");
|
m_RenderData.pCurrentMonData->m_shRGBA.topLeft = glGetUniformLocation(prog, "topLeft");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.bottomRight = glGetUniformLocation(prog, "bottomRight");
|
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.fullSize = glGetUniformLocation(prog, "fullSize");
|
m_RenderData.pCurrentMonData->m_shRGBA.fullSize = glGetUniformLocation(prog, "fullSize");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.radius = glGetUniformLocation(prog, "radius");
|
m_RenderData.pCurrentMonData->m_shRGBA.radius = glGetUniformLocation(prog, "radius");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
m_RenderData.pCurrentMonData->m_shRGBA.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
||||||
@@ -182,7 +180,6 @@ void CHyprOpenGLImpl::initShaders() {
|
|||||||
m_RenderData.pCurrentMonData->m_shRGBX.posAttrib = glGetAttribLocation(prog, "pos");
|
m_RenderData.pCurrentMonData->m_shRGBX.posAttrib = glGetAttribLocation(prog, "pos");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.discardOpaque = glGetUniformLocation(prog, "discardOpaque");
|
m_RenderData.pCurrentMonData->m_shRGBX.discardOpaque = glGetUniformLocation(prog, "discardOpaque");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.topLeft = glGetUniformLocation(prog, "topLeft");
|
m_RenderData.pCurrentMonData->m_shRGBX.topLeft = glGetUniformLocation(prog, "topLeft");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.bottomRight = glGetUniformLocation(prog, "bottomRight");
|
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.fullSize = glGetUniformLocation(prog, "fullSize");
|
m_RenderData.pCurrentMonData->m_shRGBX.fullSize = glGetUniformLocation(prog, "fullSize");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.radius = glGetUniformLocation(prog, "radius");
|
m_RenderData.pCurrentMonData->m_shRGBX.radius = glGetUniformLocation(prog, "radius");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
m_RenderData.pCurrentMonData->m_shRGBX.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
||||||
@@ -198,7 +195,6 @@ void CHyprOpenGLImpl::initShaders() {
|
|||||||
m_RenderData.pCurrentMonData->m_shEXT.texAttrib = glGetAttribLocation(prog, "texcoord");
|
m_RenderData.pCurrentMonData->m_shEXT.texAttrib = glGetAttribLocation(prog, "texcoord");
|
||||||
m_RenderData.pCurrentMonData->m_shEXT.discardOpaque = glGetUniformLocation(prog, "discardOpaque");
|
m_RenderData.pCurrentMonData->m_shEXT.discardOpaque = glGetUniformLocation(prog, "discardOpaque");
|
||||||
m_RenderData.pCurrentMonData->m_shEXT.topLeft = glGetUniformLocation(prog, "topLeft");
|
m_RenderData.pCurrentMonData->m_shEXT.topLeft = glGetUniformLocation(prog, "topLeft");
|
||||||
m_RenderData.pCurrentMonData->m_shEXT.bottomRight = glGetUniformLocation(prog, "bottomRight");
|
|
||||||
m_RenderData.pCurrentMonData->m_shEXT.fullSize = glGetUniformLocation(prog, "fullSize");
|
m_RenderData.pCurrentMonData->m_shEXT.fullSize = glGetUniformLocation(prog, "fullSize");
|
||||||
m_RenderData.pCurrentMonData->m_shEXT.radius = glGetUniformLocation(prog, "radius");
|
m_RenderData.pCurrentMonData->m_shEXT.radius = glGetUniformLocation(prog, "radius");
|
||||||
m_RenderData.pCurrentMonData->m_shEXT.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
m_RenderData.pCurrentMonData->m_shEXT.primitiveMultisample = glGetUniformLocation(prog, "primitiveMultisample");
|
||||||
@@ -314,6 +310,7 @@ void CHyprOpenGLImpl::scissor(const int x, const int y, const int w, const int h
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col, int round) {
|
void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col, int round) {
|
||||||
|
if(pixman_region32_not_empty(m_RenderData.pDamage))
|
||||||
renderRectWithDamage(box, col, m_RenderData.pDamage, round);
|
renderRectWithDamage(box, col, m_RenderData.pDamage, round);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,15 +335,17 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, pixm
|
|||||||
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
||||||
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);
|
||||||
|
|
||||||
const auto TOPLEFT = Vector2D(round, round);
|
wlr_box transformedBox;
|
||||||
const auto BOTTOMRIGHT = Vector2D(box->width - round, box->height - round);
|
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform),
|
||||||
const auto FULLSIZE = Vector2D(box->width, box->height);
|
m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
|
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
||||||
|
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||||
|
|
||||||
static auto *const PMULTISAMPLEEDGES = &g_pConfigManager->getConfigValuePtr("decoration:multisample_edges")->intValue;
|
static auto *const PMULTISAMPLEEDGES = &g_pConfigManager->getConfigValuePtr("decoration:multisample_edges")->intValue;
|
||||||
|
|
||||||
// Rounded corners
|
// Rounded corners
|
||||||
glUniform2f(m_RenderData.pCurrentMonData->m_shQUAD.topLeft, (float)TOPLEFT.x, (float)TOPLEFT.y);
|
glUniform2f(m_RenderData.pCurrentMonData->m_shQUAD.topLeft, (float)TOPLEFT.x, (float)TOPLEFT.y);
|
||||||
glUniform2f(m_RenderData.pCurrentMonData->m_shQUAD.bottomRight, (float)BOTTOMRIGHT.x, (float)BOTTOMRIGHT.y);
|
|
||||||
glUniform2f(m_RenderData.pCurrentMonData->m_shQUAD.fullSize, (float)FULLSIZE.x, (float)FULLSIZE.y);
|
glUniform2f(m_RenderData.pCurrentMonData->m_shQUAD.fullSize, (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||||
glUniform1f(m_RenderData.pCurrentMonData->m_shQUAD.radius, round);
|
glUniform1f(m_RenderData.pCurrentMonData->m_shQUAD.radius, round);
|
||||||
glUniform1i(m_RenderData.pCurrentMonData->m_shQUAD.primitiveMultisample, (int)(*PMULTISAMPLEEDGES == 1 && round != 0));
|
glUniform1i(m_RenderData.pCurrentMonData->m_shQUAD.primitiveMultisample, (int)(*PMULTISAMPLEEDGES == 1 && round != 0));
|
||||||
@@ -357,7 +356,21 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, pixm
|
|||||||
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shQUAD.posAttrib);
|
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shQUAD.posAttrib);
|
||||||
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shQUAD.texAttrib);
|
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shQUAD.texAttrib);
|
||||||
|
|
||||||
if (pixman_region32_not_empty(damage)) {
|
if (m_RenderData.clipBox.width != 0 && m_RenderData.clipBox.height != 0) {
|
||||||
|
pixman_region32_t damageClip;
|
||||||
|
pixman_region32_init(&damageClip);
|
||||||
|
pixman_region32_intersect_rect(&damageClip, damage, m_RenderData.clipBox.x, m_RenderData.clipBox.y, m_RenderData.clipBox.width, m_RenderData.clipBox.height);
|
||||||
|
|
||||||
|
if (pixman_region32_not_empty(&damageClip)) {
|
||||||
|
PIXMAN_DAMAGE_FOREACH(&damageClip) {
|
||||||
|
const auto RECT = RECTSARR[i];
|
||||||
|
scissor(&RECT);
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pixman_region32_fini(&damageClip);
|
||||||
|
} else {
|
||||||
PIXMAN_DAMAGE_FOREACH(damage) {
|
PIXMAN_DAMAGE_FOREACH(damage) {
|
||||||
const auto RECT = RECTSARR[i];
|
const auto RECT = RECTSARR[i];
|
||||||
scissor(&RECT);
|
scissor(&RECT);
|
||||||
@@ -389,6 +402,9 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||||||
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!");
|
||||||
|
|
||||||
|
if (!pixman_region32_not_empty(m_RenderData.pDamage))
|
||||||
|
return;
|
||||||
|
|
||||||
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
|
||||||
@@ -433,18 +449,17 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||||||
glUniform1f(shader->alpha, alpha / 255.f);
|
glUniform1f(shader->alpha, alpha / 255.f);
|
||||||
glUniform1i(shader->discardOpaque, (int)discardOpaque);
|
glUniform1i(shader->discardOpaque, (int)discardOpaque);
|
||||||
|
|
||||||
// round is in px
|
wlr_box transformedBox;
|
||||||
// so we need to do some maf
|
wlr_box_transform(&transformedBox, pBox, wlr_output_transform_invert(m_RenderData.pMonitor->transform),
|
||||||
|
m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
const auto TOPLEFT = Vector2D(round, round);
|
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
||||||
const auto BOTTOMRIGHT = Vector2D(pBox->width - round, pBox->height - round);
|
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||||
const auto FULLSIZE = Vector2D(pBox->width, pBox->height);
|
|
||||||
static auto *const PMULTISAMPLEEDGES = &g_pConfigManager->getConfigValuePtr("decoration:multisample_edges")->intValue;
|
static auto *const PMULTISAMPLEEDGES = &g_pConfigManager->getConfigValuePtr("decoration:multisample_edges")->intValue;
|
||||||
|
|
||||||
// Rounded corners
|
// Rounded corners
|
||||||
glUniform2f(shader->topLeft, (float)TOPLEFT.x, (float)TOPLEFT.y);
|
glUniform2f(shader->topLeft, TOPLEFT.x, TOPLEFT.y);
|
||||||
glUniform2f(shader->bottomRight, (float)BOTTOMRIGHT.x, (float)BOTTOMRIGHT.y);
|
glUniform2f(shader->fullSize, FULLSIZE.x ,FULLSIZE.y);
|
||||||
glUniform2f(shader->fullSize, (float)FULLSIZE.x, (float)FULLSIZE.y);
|
|
||||||
glUniform1f(shader->radius, round);
|
glUniform1f(shader->radius, round);
|
||||||
glUniform1i(shader->primitiveMultisample, (int)(*PMULTISAMPLEEDGES == 1 && round != 0 && !noAA));
|
glUniform1i(shader->primitiveMultisample, (int)(*PMULTISAMPLEEDGES == 1 && round != 0 && !noAA));
|
||||||
|
|
||||||
@@ -474,8 +489,22 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||||||
glEnableVertexAttribArray(shader->posAttrib);
|
glEnableVertexAttribArray(shader->posAttrib);
|
||||||
glEnableVertexAttribArray(shader->texAttrib);
|
glEnableVertexAttribArray(shader->texAttrib);
|
||||||
|
|
||||||
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
if (m_RenderData.clipBox.width != 0 && m_RenderData.clipBox.height != 0) {
|
||||||
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
pixman_region32_t damageClip;
|
||||||
|
pixman_region32_init(&damageClip);
|
||||||
|
pixman_region32_intersect_rect(&damageClip, damage, m_RenderData.clipBox.x, m_RenderData.clipBox.y, m_RenderData.clipBox.width, m_RenderData.clipBox.height);
|
||||||
|
|
||||||
|
if (pixman_region32_not_empty(&damageClip)) {
|
||||||
|
PIXMAN_DAMAGE_FOREACH(&damageClip) {
|
||||||
|
const auto RECT = RECTSARR[i];
|
||||||
|
scissor(&RECT);
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pixman_region32_fini(&damageClip);
|
||||||
|
} else {
|
||||||
|
PIXMAN_DAMAGE_FOREACH(damage) {
|
||||||
const auto RECT = RECTSARR[i];
|
const auto RECT = RECTSARR[i];
|
||||||
scissor(&RECT);
|
scissor(&RECT);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
@@ -649,6 +678,8 @@ void CHyprOpenGLImpl::preBlurForCurrentMonitor() {
|
|||||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &wholeMonitor, 255, &fakeDamage, 0, false, true, false);
|
renderTextureInternalWithDamage(POUTFB->m_cTex, &wholeMonitor, 255, &fakeDamage, 0, false, true, false);
|
||||||
m_bEndFrame = false;
|
m_bEndFrame = false;
|
||||||
|
|
||||||
|
pixman_region32_fini(&fakeDamage);
|
||||||
|
|
||||||
m_RenderData.pCurrentMonData->primaryFB.bind();
|
m_RenderData.pCurrentMonData->primaryFB.bind();
|
||||||
|
|
||||||
m_RenderData.pCurrentMonData->blurFBDirty = false;
|
m_RenderData.pCurrentMonData->blurFBDirty = false;
|
||||||
@@ -682,16 +713,19 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||||||
static auto *const PNOBLUROVERSIZED = &g_pConfigManager->getConfigValuePtr("decoration:no_blur_on_oversized")->intValue;
|
static auto *const PNOBLUROVERSIZED = &g_pConfigManager->getConfigValuePtr("decoration:no_blur_on_oversized")->intValue;
|
||||||
static auto *const PBLURNEWOPTIMIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_new_optimizations")->intValue;
|
static auto *const PBLURNEWOPTIMIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_new_optimizations")->intValue;
|
||||||
|
|
||||||
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) || (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur)) {
|
|
||||||
renderTexture(tex, pBox, a, round, false, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make a damage region for this window
|
// make a damage region for this window
|
||||||
pixman_region32_t damage;
|
pixman_region32_t damage;
|
||||||
pixman_region32_init(&damage);
|
pixman_region32_init(&damage);
|
||||||
pixman_region32_intersect_rect(&damage, m_RenderData.pDamage, pBox->x, pBox->y, pBox->width, pBox->height); // clip it to the box
|
pixman_region32_intersect_rect(&damage, m_RenderData.pDamage, pBox->x, pBox->y, pBox->width, pBox->height); // clip it to the box
|
||||||
|
|
||||||
|
if(!pixman_region32_not_empty(&damage))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) || (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur)) {
|
||||||
|
renderTexture(tex, pBox, a, round, false, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// amazing hack: the surface has an opaque region!
|
// amazing hack: the surface has an opaque region!
|
||||||
pixman_region32_t inverseOpaque;
|
pixman_region32_t inverseOpaque;
|
||||||
pixman_region32_init(&inverseOpaque);
|
pixman_region32_init(&inverseOpaque);
|
||||||
@@ -742,7 +776,6 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||||||
|
|
||||||
// stencil done. Render everything.
|
// stencil done. Render everything.
|
||||||
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
||||||
if (pixman_region32_not_empty(&damage)) {
|
|
||||||
// render our great blurred FB
|
// render our great blurred FB
|
||||||
static auto *const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur_ignore_opacity")->intValue;
|
static auto *const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur_ignore_opacity")->intValue;
|
||||||
m_bEndFrame = true; // fix transformed
|
m_bEndFrame = true; // fix transformed
|
||||||
@@ -756,7 +789,6 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||||||
// draw window
|
// draw window
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
renderTextureInternalWithDamage(tex, pBox, a, &damage, round, false, false, true, true);
|
renderTextureInternalWithDamage(tex, pBox, a, &damage, round, false, false, true, true);
|
||||||
}
|
|
||||||
|
|
||||||
glStencilMask(-1);
|
glStencilMask(-1);
|
||||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||||
@@ -775,6 +807,9 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int round) {
|
|||||||
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
||||||
|
|
||||||
|
if (!pixman_region32_not_empty(m_RenderData.pDamage))
|
||||||
|
return;
|
||||||
|
|
||||||
static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
|
static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
|
||||||
static auto *const PMULTISAMPLE = &g_pConfigManager->getConfigValuePtr("decoration:multisample_edges")->intValue;
|
static auto *const PMULTISAMPLE = &g_pConfigManager->getConfigValuePtr("decoration:multisample_edges")->intValue;
|
||||||
|
|
||||||
@@ -839,7 +874,21 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int round) {
|
|||||||
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shBORDER1.posAttrib);
|
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shBORDER1.posAttrib);
|
||||||
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shBORDER1.texAttrib);
|
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shBORDER1.texAttrib);
|
||||||
|
|
||||||
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
if (m_RenderData.clipBox.width != 0 && m_RenderData.clipBox.height != 0) {
|
||||||
|
pixman_region32_t damageClip;
|
||||||
|
pixman_region32_init(&damageClip);
|
||||||
|
pixman_region32_intersect_rect(&damageClip, m_RenderData.pDamage, m_RenderData.clipBox.x, m_RenderData.clipBox.y, m_RenderData.clipBox.width, m_RenderData.clipBox.height);
|
||||||
|
|
||||||
|
if (pixman_region32_not_empty(&damageClip)) {
|
||||||
|
PIXMAN_DAMAGE_FOREACH(&damageClip) {
|
||||||
|
const auto RECT = RECTSARR[i];
|
||||||
|
scissor(&RECT);
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pixman_region32_fini(&damageClip);
|
||||||
|
} else {
|
||||||
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
||||||
const auto RECT = RECTSARR[i];
|
const auto RECT = RECTSARR[i];
|
||||||
scissor(&RECT);
|
scissor(&RECT);
|
||||||
@@ -1040,6 +1089,9 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
|
|||||||
RASSERT((box->width > 0 && box->height > 0), "Tried to render shadow with width/height < 0!");
|
RASSERT((box->width > 0 && box->height > 0), "Tried to render shadow with width/height < 0!");
|
||||||
RASSERT(m_pCurrentWindow, "Tried to render shadow without a window!");
|
RASSERT(m_pCurrentWindow, "Tried to render shadow without a window!");
|
||||||
|
|
||||||
|
if (!pixman_region32_not_empty(m_RenderData.pDamage))
|
||||||
|
return;
|
||||||
|
|
||||||
static auto *const PSHADOWPOWER = &g_pConfigManager->getConfigValuePtr("decoration:shadow_render_power")->intValue;
|
static auto *const PSHADOWPOWER = &g_pConfigManager->getConfigValuePtr("decoration:shadow_render_power")->intValue;
|
||||||
|
|
||||||
const auto SHADOWPOWER = std::clamp((int)*PSHADOWPOWER, 1, 4);
|
const auto SHADOWPOWER = std::clamp((int)*PSHADOWPOWER, 1, 4);
|
||||||
@@ -1081,7 +1133,21 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
|
|||||||
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shSHADOW.posAttrib);
|
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shSHADOW.posAttrib);
|
||||||
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shSHADOW.texAttrib);
|
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shSHADOW.texAttrib);
|
||||||
|
|
||||||
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
if (m_RenderData.clipBox.width != 0 && m_RenderData.clipBox.height != 0) {
|
||||||
|
pixman_region32_t damageClip;
|
||||||
|
pixman_region32_init(&damageClip);
|
||||||
|
pixman_region32_intersect_rect(&damageClip, m_RenderData.pDamage, m_RenderData.clipBox.x, m_RenderData.clipBox.y, m_RenderData.clipBox.width, m_RenderData.clipBox.height);
|
||||||
|
|
||||||
|
if (pixman_region32_not_empty(&damageClip)) {
|
||||||
|
PIXMAN_DAMAGE_FOREACH(&damageClip) {
|
||||||
|
const auto RECT = RECTSARR[i];
|
||||||
|
scissor(&RECT);
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pixman_region32_fini(&damageClip);
|
||||||
|
} else {
|
||||||
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
||||||
const auto RECT = RECTSARR[i];
|
const auto RECT = RECTSARR[i];
|
||||||
scissor(&RECT);
|
scissor(&RECT);
|
||||||
@@ -1225,17 +1291,32 @@ void CHyprOpenGLImpl::clearWithTex() {
|
|||||||
static auto *const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue;
|
static auto *const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue;
|
||||||
|
|
||||||
if (!*PRENDERTEX) {
|
if (!*PRENDERTEX) {
|
||||||
renderTexture(m_mMonitorBGTextures[m_RenderData.pMonitor], &m_mMonitorRenderResources[m_RenderData.pMonitor].backgroundTexBox, 255, 0);
|
auto TEXIT = m_mMonitorBGTextures.find(m_RenderData.pMonitor);
|
||||||
|
|
||||||
|
if (TEXIT == m_mMonitorBGTextures.end()) {
|
||||||
|
createBGTextureForMonitor(m_RenderData.pMonitor);
|
||||||
|
TEXIT = m_mMonitorBGTextures.find(m_RenderData.pMonitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TEXIT != m_mMonitorBGTextures.end())
|
||||||
|
renderTexture(TEXIT->second, &m_mMonitorRenderResources[m_RenderData.pMonitor].backgroundTexBox, 255, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
|
void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
|
||||||
|
wlr_output_attach_render(pMonitor->output, nullptr);
|
||||||
|
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorFB.release();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorFB.release();
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].primaryFB.release();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].primaryFB.release();
|
||||||
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorSwapFB.release();
|
||||||
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].monitorMirrorFB.release();
|
||||||
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].blurFB.release();
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].stencilTex.destroyTexture();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].stencilTex.destroyTexture();
|
||||||
g_pHyprOpenGL->m_mMonitorBGTextures[pMonitor].destroyTexture();
|
g_pHyprOpenGL->m_mMonitorBGTextures[pMonitor].destroyTexture();
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources.erase(pMonitor);
|
g_pHyprOpenGL->m_mMonitorRenderResources.erase(pMonitor);
|
||||||
g_pHyprOpenGL->m_mMonitorBGTextures.erase(pMonitor);
|
g_pHyprOpenGL->m_mMonitorBGTextures.erase(pMonitor);
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor %s -> destroyed all render data", pMonitor->szName.c_str());
|
Debug::log(LOG, "Monitor %s -> destroyed all render data", pMonitor->szName.c_str());
|
||||||
|
|
||||||
|
wlr_output_rollback(pMonitor->output);
|
||||||
}
|
}
|
||||||
|
@@ -67,6 +67,8 @@ struct SCurrentRenderData {
|
|||||||
|
|
||||||
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
||||||
Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);
|
Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);
|
||||||
|
|
||||||
|
wlr_box clipBox = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CHyprOpenGLImpl {
|
class CHyprOpenGLImpl {
|
||||||
|
@@ -248,11 +248,38 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||||||
|
|
||||||
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
|
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
|
||||||
|
|
||||||
|
// clip box for animated offsets
|
||||||
|
Vector2D offset;
|
||||||
|
if (PWORKSPACE->m_vRenderOffset.vec().x != 0) {
|
||||||
|
const auto PWSMON = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID);
|
||||||
|
const auto PROGRESS = PWORKSPACE->m_vRenderOffset.vec().x / PWSMON->vecSize.x;
|
||||||
|
const auto WINBB = pWindow->getFullWindowBoundingBox();
|
||||||
|
|
||||||
|
if (WINBB.x < PWSMON->vecPosition.x) {
|
||||||
|
offset.x = (PWSMON->vecPosition.x - WINBB.x) * PROGRESS;
|
||||||
|
} else if (WINBB.x > PWSMON->vecPosition.x + PWSMON->vecSize.x) {
|
||||||
|
offset.x = (WINBB.x - PWSMON->vecPosition.x + PWSMON->vecSize.x) * PROGRESS;
|
||||||
|
}
|
||||||
|
} else if (PWORKSPACE->m_vRenderOffset.vec().y) {
|
||||||
|
const auto PWSMON = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID);
|
||||||
|
const auto PROGRESS = PWORKSPACE->m_vRenderOffset.vec().y / PWSMON->vecSize.y;
|
||||||
|
const auto WINBB = pWindow->getFullWindowBoundingBox();
|
||||||
|
|
||||||
|
if (WINBB.y < PWSMON->vecPosition.y) {
|
||||||
|
offset.y = (PWSMON->vecPosition.y - WINBB.y) * PROGRESS;
|
||||||
|
} else if (WINBB.y > PWSMON->vecPosition.y + PWSMON->vecSize.y) {
|
||||||
|
offset.y = (WINBB.y - PWSMON->vecPosition.y + PWSMON->vecSize.y) * PROGRESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderdata.x += offset.x;
|
||||||
|
renderdata.y += offset.y;
|
||||||
|
|
||||||
// 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);
|
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);
|
||||||
|
|
||||||
@@ -289,6 +316,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprOpenGL->m_pCurrentWindow = nullptr;
|
g_pHyprOpenGL->m_pCurrentWindow = nullptr;
|
||||||
|
g_pHyprOpenGL->m_RenderData.clipBox = { 0, 0, 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderLayer(SLayerSurface* pLayer, CMonitor* pMonitor, timespec* time) {
|
void CHyprRenderer::renderLayer(SLayerSurface* pLayer, CMonitor* pMonitor, timespec* time) {
|
||||||
@@ -1131,9 +1159,6 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
wlr_output_enable_adaptive_sync(pMonitor->output, 0);
|
wlr_output_enable_adaptive_sync(pMonitor->output, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update renderer
|
|
||||||
g_pHyprOpenGL->destroyMonitorResources(pMonitor);
|
|
||||||
|
|
||||||
if (!wlr_output_commit(pMonitor->output)) {
|
if (!wlr_output_commit(pMonitor->output)) {
|
||||||
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
||||||
return true;
|
return true;
|
||||||
@@ -1165,6 +1190,9 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||||||
|
|
||||||
wlr_output_enable(pMonitor->output, true);
|
wlr_output_enable(pMonitor->output, true);
|
||||||
|
|
||||||
|
// update renderer (here because it will call rollback, so we cannot do this before committing)
|
||||||
|
g_pHyprOpenGL->destroyMonitorResources(pMonitor);
|
||||||
|
|
||||||
// updato wlroots
|
// updato wlroots
|
||||||
Events::listener_change(nullptr, nullptr);
|
Events::listener_change(nullptr, nullptr);
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(m_pWindow))
|
if (!g_pCompositor->windowValidMapped(m_pWindow))
|
||||||
return;
|
return;
|
||||||
@@ -79,6 +79,9 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
|||||||
fullBox.x -= pMonitor->vecPosition.x;
|
fullBox.x -= pMonitor->vecPosition.x;
|
||||||
fullBox.y -= pMonitor->vecPosition.y;
|
fullBox.y -= pMonitor->vecPosition.y;
|
||||||
|
|
||||||
|
fullBox.x += offset.x;
|
||||||
|
fullBox.y += offset.y;
|
||||||
|
|
||||||
if (fullBox.width < 1 || fullBox.height < 1)
|
if (fullBox.width < 1 || fullBox.height < 1)
|
||||||
return; // don't draw invisible shadows
|
return; // don't draw invisible shadows
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ public:
|
|||||||
|
|
||||||
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
||||||
|
|
||||||
virtual void draw(CMonitor*, float a);
|
virtual void draw(CMonitor*, float a, const Vector2D& offset);
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType();
|
virtual eDecorationType getDecorationType();
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ void CHyprGroupBarDecoration::damageEntire() {
|
|||||||
g_pHyprRenderer->damageBox(&dm);
|
g_pHyprRenderer->damageBox(&dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
|
void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
// get how many bars we will draw
|
// get how many bars we will draw
|
||||||
int barsToDraw = m_dwGroupMembers.size();
|
int barsToDraw = m_dwGroupMembers.size();
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
|
|||||||
int xoff = 0;
|
int xoff = 0;
|
||||||
|
|
||||||
for (int i = 0; i < barsToDraw; ++i) {
|
for (int i = 0; i < barsToDraw; ++i) {
|
||||||
wlr_box rect = {m_vLastWindowPos.x + xoff - pMonitor->vecPosition.x, m_vLastWindowPos.y - m_seExtents.topLeft.y - pMonitor->vecPosition.y, BARW, 3};
|
wlr_box rect = {m_vLastWindowPos.x + xoff - pMonitor->vecPosition.x + offset.x, m_vLastWindowPos.y - m_seExtents.topLeft.y - pMonitor->vecPosition.y + offset.y, BARW, 3};
|
||||||
|
|
||||||
if (rect.width <= 0 || rect.height <= 0)
|
if (rect.width <= 0 || rect.height <= 0)
|
||||||
break;
|
break;
|
||||||
|
@@ -10,7 +10,7 @@ public:
|
|||||||
|
|
||||||
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
virtual SWindowDecorationExtents getWindowDecorationExtents();
|
||||||
|
|
||||||
virtual void draw(CMonitor*, float a);
|
virtual void draw(CMonitor*, float a, const Vector2D& offset);
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType();
|
virtual eDecorationType getDecorationType();
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ public:
|
|||||||
|
|
||||||
virtual SWindowDecorationExtents getWindowDecorationExtents() = 0;
|
virtual SWindowDecorationExtents getWindowDecorationExtents() = 0;
|
||||||
|
|
||||||
virtual void draw(CMonitor*, float a) = 0;
|
virtual void draw(CMonitor*, float a, const Vector2D& offset = Vector2D()) = 0;
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType() = 0;
|
virtual eDecorationType getDecorationType() = 0;
|
||||||
|
|
||||||
|
@@ -4,137 +4,35 @@
|
|||||||
|
|
||||||
inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVarName) -> std::string {
|
inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVarName) -> std::string {
|
||||||
return R"#(
|
return R"#(
|
||||||
if (pixCoord[0] < topLeft[0]) {
|
|
||||||
// we're close left
|
|
||||||
if (pixCoord[1] < topLeft[1]) {
|
|
||||||
// top
|
|
||||||
|
|
||||||
if (ignoreCorners == 1) {
|
// branchless baby!
|
||||||
|
highp vec2 pixCoord = vec2(gl_FragCoord);
|
||||||
|
pixCoord -= topLeft + fullSize * 0.5;
|
||||||
|
pixCoord *= vec2(lessThan(pixCoord, vec2(0.0))) * -2.0 + 1.0;
|
||||||
|
pixCoord -= fullSize * 0.5 - radius;
|
||||||
|
|
||||||
|
if (pixCoord.x + pixCoord.y > radius) {
|
||||||
|
|
||||||
|
float dist = length(pixCoord);
|
||||||
|
|
||||||
|
if (dist > radius)
|
||||||
discard;
|
discard;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float topLeftDistance = distance(topLeft, pixCoord);
|
if (primitiveMultisample == 1 && dist > radius - 1.0) {
|
||||||
|
|
||||||
if (topLeftDistance > radius - 1.0) {
|
|
||||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
} else if (primitiveMultisample == 1) {
|
|
||||||
float distances = 0.0;
|
float distances = 0.0;
|
||||||
if (distance(topLeft, pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
distances += float(length(pixCoord + vec2(0.25, 0.25)) < radius);
|
||||||
if (distance(topLeft, pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
distances += float(length(pixCoord + vec2(0.75, 0.25)) < radius);
|
||||||
if (distance(topLeft, pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
distances += float(length(pixCoord + vec2(0.25, 0.75)) < radius);
|
||||||
if (distance(topLeft, pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
distances += float(length(pixCoord + vec2(0.75, 0.75)) < radius);
|
||||||
|
|
||||||
if (distances == 0.0) {
|
if (distances == 0.0)
|
||||||
discard;
|
discard;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
distances = distances / 4.0;
|
distances /= 4.0;
|
||||||
|
|
||||||
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (pixCoord[1] > bottomRight[1]) {
|
|
||||||
// bottom
|
|
||||||
|
|
||||||
if (ignoreCorners == 1) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float topLeftDistance = distance(vec2(topLeft[0], bottomRight[1]), pixCoord);
|
|
||||||
|
|
||||||
if (topLeftDistance > radius - 1.0) {
|
|
||||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
} else if (primitiveMultisample == 1) {
|
|
||||||
float distances = 0.0;
|
|
||||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
|
||||||
|
|
||||||
if (distances == 0.0) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
distances = distances / 4.0;
|
|
||||||
|
|
||||||
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (pixCoord[0] > bottomRight[0]) {
|
|
||||||
// we're close right
|
|
||||||
if (pixCoord[1] < topLeft[1]) {
|
|
||||||
// top
|
|
||||||
|
|
||||||
if (ignoreCorners == 1) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float topLeftDistance = distance(vec2(bottomRight[0], topLeft[1]), pixCoord);
|
|
||||||
|
|
||||||
if (topLeftDistance > radius - 1.0) {
|
|
||||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
} else if (primitiveMultisample == 1) {
|
|
||||||
float distances = 0.0;
|
|
||||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
|
||||||
|
|
||||||
if (distances == 0.0) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
distances = distances / 4.0;
|
|
||||||
|
|
||||||
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (pixCoord[1] > bottomRight[1]) {
|
|
||||||
// bottom
|
|
||||||
|
|
||||||
if (ignoreCorners == 1) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float topLeftDistance = distance(bottomRight, pixCoord);
|
|
||||||
|
|
||||||
if (topLeftDistance > radius - 1.0) {
|
|
||||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
} else if (primitiveMultisample == 1) {
|
|
||||||
float distances = 0.0;
|
|
||||||
if (distance(bottomRight, pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(bottomRight, pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(bottomRight, pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
|
||||||
if (distance(bottomRight, pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
|
||||||
|
|
||||||
if (distances == 0.0) {
|
|
||||||
discard;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
distances = distances / 4.0;
|
|
||||||
|
|
||||||
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)#";
|
)#";
|
||||||
};
|
};
|
||||||
@@ -156,27 +54,20 @@ void main() {
|
|||||||
inline const std::string QUADFRAGSRC = R"#(
|
inline const std::string QUADFRAGSRC = R"#(
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
varying vec2 v_texcoord;
|
|
||||||
|
|
||||||
uniform vec2 topLeft;
|
uniform vec2 topLeft;
|
||||||
uniform vec2 bottomRight;
|
|
||||||
uniform vec2 fullSize;
|
uniform vec2 fullSize;
|
||||||
uniform float radius;
|
uniform float radius;
|
||||||
|
|
||||||
uniform int primitiveMultisample;
|
uniform int primitiveMultisample;
|
||||||
uniform int ignoreCorners;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
if (radius == 0.0) {
|
|
||||||
gl_FragColor = v_color;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 pixColor = v_color;
|
vec4 pixColor = v_color;
|
||||||
|
|
||||||
vec2 pixCoord = fullSize * v_texcoord;
|
if (radius > 0.0) {
|
||||||
|
|
||||||
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||||
|
}
|
||||||
|
|
||||||
gl_FragColor = pixColor;
|
gl_FragColor = pixColor;
|
||||||
})#";
|
})#";
|
||||||
@@ -199,7 +90,6 @@ uniform sampler2D tex;
|
|||||||
uniform float alpha;
|
uniform float alpha;
|
||||||
|
|
||||||
uniform vec2 topLeft;
|
uniform vec2 topLeft;
|
||||||
uniform vec2 bottomRight;
|
|
||||||
uniform vec2 fullSize;
|
uniform vec2 fullSize;
|
||||||
uniform float radius;
|
uniform float radius;
|
||||||
|
|
||||||
@@ -209,16 +99,14 @@ uniform int applyTint;
|
|||||||
uniform vec3 tint;
|
uniform vec3 tint;
|
||||||
|
|
||||||
uniform int primitiveMultisample;
|
uniform int primitiveMultisample;
|
||||||
uniform int ignoreCorners;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
vec4 pixColor = texture2D(tex, v_texcoord);
|
vec4 pixColor = texture2D(tex, v_texcoord);
|
||||||
|
|
||||||
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0) {
|
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0)
|
||||||
discard;
|
discard;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (applyTint == 1) {
|
if (applyTint == 1) {
|
||||||
pixColor[0] = pixColor[0] * tint[0];
|
pixColor[0] = pixColor[0] * tint[0];
|
||||||
@@ -226,10 +114,7 @@ void main() {
|
|||||||
pixColor[2] = pixColor[2] * tint[2];
|
pixColor[2] = pixColor[2] * tint[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 pixCoord = fullSize * v_texcoord;
|
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||||
|
|
||||||
)#" + ROUNDED_SHADER_FUNC("pixColor") +
|
|
||||||
R"#(
|
|
||||||
|
|
||||||
gl_FragColor = pixColor * alpha;
|
gl_FragColor = pixColor * alpha;
|
||||||
})#";
|
})#";
|
||||||
@@ -241,7 +126,6 @@ uniform sampler2D tex;
|
|||||||
uniform float alpha;
|
uniform float alpha;
|
||||||
|
|
||||||
uniform vec2 topLeft;
|
uniform vec2 topLeft;
|
||||||
uniform vec2 bottomRight;
|
|
||||||
uniform vec2 fullSize;
|
uniform vec2 fullSize;
|
||||||
uniform float radius;
|
uniform float radius;
|
||||||
|
|
||||||
@@ -251,14 +135,11 @@ uniform int applyTint;
|
|||||||
uniform vec3 tint;
|
uniform vec3 tint;
|
||||||
|
|
||||||
uniform int primitiveMultisample;
|
uniform int primitiveMultisample;
|
||||||
uniform int ignoreCorners;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
if (discardOpaque == 1 && alpha == 1.0) {
|
if (discardOpaque == 1 && alpha == 1.0)
|
||||||
discard;
|
discard;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 pixColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0);
|
vec4 pixColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0);
|
||||||
|
|
||||||
@@ -268,10 +149,7 @@ void main() {
|
|||||||
pixColor[2] = pixColor[2] * tint[2];
|
pixColor[2] = pixColor[2] * tint[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 pixCoord = fullSize * v_texcoord;
|
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||||
|
|
||||||
)#" + ROUNDED_SHADER_FUNC("pixColor") +
|
|
||||||
R"#(
|
|
||||||
|
|
||||||
gl_FragColor = pixColor * alpha;
|
gl_FragColor = pixColor * alpha;
|
||||||
})#";
|
})#";
|
||||||
@@ -293,6 +171,7 @@ void main() {
|
|||||||
sum += texture2D(tex, uv + halfpixel.xy * radius);
|
sum += texture2D(tex, uv + halfpixel.xy * radius);
|
||||||
sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius);
|
sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius);
|
||||||
sum += texture2D(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius);
|
sum += texture2D(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius);
|
||||||
|
|
||||||
gl_FragColor = sum / 8.0;
|
gl_FragColor = sum / 8.0;
|
||||||
}
|
}
|
||||||
)#";
|
)#";
|
||||||
@@ -332,7 +211,6 @@ uniform samplerExternalOES texture0;
|
|||||||
uniform float alpha;
|
uniform float alpha;
|
||||||
|
|
||||||
uniform vec2 topLeft;
|
uniform vec2 topLeft;
|
||||||
uniform vec2 bottomRight;
|
|
||||||
uniform vec2 fullSize;
|
uniform vec2 fullSize;
|
||||||
uniform float radius;
|
uniform float radius;
|
||||||
|
|
||||||
@@ -342,16 +220,13 @@ uniform int applyTint;
|
|||||||
uniform vec3 tint;
|
uniform vec3 tint;
|
||||||
|
|
||||||
uniform int primitiveMultisample;
|
uniform int primitiveMultisample;
|
||||||
uniform int ignoreCorners;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
vec4 pixColor = texture2D(texture0, v_texcoord);
|
vec4 pixColor = texture2D(texture0, v_texcoord);
|
||||||
|
|
||||||
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0) {
|
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0)
|
||||||
discard;
|
discard;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (applyTint == 1) {
|
if (applyTint == 1) {
|
||||||
pixColor[0] = pixColor[0] * tint[0];
|
pixColor[0] = pixColor[0] * tint[0];
|
||||||
@@ -359,10 +234,8 @@ void main() {
|
|||||||
pixColor[2] = pixColor[2] * tint[2];
|
pixColor[2] = pixColor[2] * tint[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 pixCoord = fullSize * v_texcoord;
|
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||||
|
|
||||||
)#" + ROUNDED_SHADER_FUNC("pixColor") +
|
|
||||||
R"#(
|
|
||||||
|
|
||||||
gl_FragColor = pixColor * alpha;
|
gl_FragColor = pixColor * alpha;
|
||||||
})#";
|
}
|
||||||
|
)#";
|
||||||
|
Submodule subprojects/wlroots updated: 50cc1ef4d3...ab8341975e
Reference in New Issue
Block a user