summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorDarksome <dev@darkso.me>2022-07-15 19:42:03 +0300
committerDarksome <dev@darkso.me>2022-07-15 19:42:03 +0300
commit5388b54442614cb0d3d445f101e7cd86bf64c125 (patch)
tree26057ff185e423e944e8b250ed7fe26654b69623 /src/helpers
parentcb8a6f881b11e9a269fd5f7aa64eafe2beda0b0d (diff)
parent6306d4dae3fa221a6099e109c7faef60bac4fac5 (diff)
Merge upstream
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/AnimatedVariable.hpp6
-rw-r--r--src/helpers/MiscFunctions.cpp6
-rw-r--r--src/helpers/Splashes.hpp56
-rw-r--r--src/helpers/Vector2D.cpp8
-rw-r--r--src/helpers/Vector2D.hpp2
-rw-r--r--src/helpers/WLClasses.hpp50
-rw-r--r--src/helpers/Workspace.hpp1
7 files changed, 122 insertions, 7 deletions
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp
index ceda2c57..a87fff4f 100644
--- a/src/helpers/AnimatedVariable.hpp
+++ b/src/helpers/AnimatedVariable.hpp
@@ -128,10 +128,10 @@ public:
case AVARTYPE_COLOR:
return m_cValue != m_cGoal;
default:
- return false;
+ std::unreachable();
}
- return false; // unreachable
+ std::unreachable();
}
void warp() {
@@ -149,7 +149,7 @@ public:
break;
}
default:
- break;
+ std::unreachable();
}
}
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index cb1d88d6..126600f3 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -137,7 +137,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
if (source.find_first_of("+") == 0) {
try {
- if (source.find('.') != std::string::npos)
+ if (source.contains("."))
result = relative + std::stof(source.substr(1));
else
result = relative + std::stoi(source.substr(1));
@@ -147,7 +147,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
}
} else if (source.find_first_of("-") == 0) {
try {
- if (source.find('.') != std::string::npos)
+ if (source.contains("."))
result = relative - std::stof(source.substr(1));
else
result = relative - std::stoi(source.substr(1));
@@ -157,7 +157,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
}
} else {
try {
- if (source.find('.') != std::string::npos)
+ if (source.contains("."))
result = stof(source);
else
result = stoi(source);
diff --git a/src/helpers/Splashes.hpp b/src/helpers/Splashes.hpp
new file mode 100644
index 00000000..68681ca2
--- /dev/null
+++ b/src/helpers/Splashes.hpp
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <array>
+#include <string>
+
+inline const std::vector<std::string> SPLASHES = {
+ "Woo, animations!",
+ "It's like Hypr, but better.",
+ "Release 1.0 when?",
+ "It's not awesome, it's Hyprland!",
+ "\"I commit too often, people can't catch up lmao\" - Vaxry",
+ "This text is random.",
+ "\"There are reasons to not use rust.\" - Boga",
+ "Read the wiki.",
+ "\"Hello everyone this is YOUR daily dose of ‘read the wiki’\" - Vaxry",
+ "h",
+ "\"‘why no work’, bro I haven't hacked your pc to get live feeds yet\" - Vaxry",
+ "Compile, wait for 20 minutes, notice a new commit, compile again.",
+ "To rice, or not to rice, that is the question.",
+ "Now available on Fedora!",
+ // music reference / quote section
+ "J'remue le ciel, le jour, la nuit.",
+ "aezakmi, aezakmi, aezakmi, aezakmi, aezakmi, aezakmi, aezakmi!",
+ "Wir sind schon sehr lang zusammen...",
+ "I see a red door and I want it painted black.",
+ "Take on me, take me on...",
+ "You spin me right round baby right round",
+ "Stayin' alive, stayin' alive",
+ "Say no way, say no way ya, no way!",
+ "Ground control to Major Tom...",
+ "Alors on danse",
+ "And all that I can see, is just a yellow lemon tree.",
+ "Got a one-way ticket to the blues",
+ "Is this the real life, is this just fantasy",
+ "What's in your head, in your head?",
+ "We're all living in America, America, America.",
+ "I'm still standing, better than I ever did",
+ "Here comes the sun, bringing you love and shining on everyone",
+ "Two trailer park girls go round the outside",
+ "With the lights out, it's less dangerous",
+ "Here we go back, this is the moment, tonight is the night",
+ "Now you're just somebody that I used to know...",
+ "Black bird, black moon, black sky",
+ "Some legends are told, some turn to dust or to gold",
+ "Your brain gets smart, but your head gets dumb.",
+ "Save your mercy for someone who needs it more",
+ "You're gonna hear my voice when I shout it out loud",
+ "Ding ding pch n daa, bam-ba-ba-re-bam baram bom bom baba-bam-bam-bommm",
+ "Súbeme la radio que esta es mi canción",
+ "I'm beggin', beggin' you",
+ //
+ "Join the discord server!",
+ "Thanks ThatOneCalculator!",
+ "The AUR packages always work, except for the times they don't.",
+ "Funny animation compositor woo"
+}; \ No newline at end of file
diff --git a/src/helpers/Vector2D.cpp b/src/helpers/Vector2D.cpp
index acaace13..a96411e6 100644
--- a/src/helpers/Vector2D.cpp
+++ b/src/helpers/Vector2D.cpp
@@ -1,4 +1,5 @@
#include "Vector2D.hpp"
+#include <algorithm>
Vector2D::Vector2D(double xx, double yy) {
x = xx;
@@ -20,4 +21,11 @@ double Vector2D::normalize() {
Vector2D Vector2D::floor() {
return Vector2D((int)x, (int)y);
+}
+
+Vector2D Vector2D::clamp(const Vector2D& min, const Vector2D& max) {
+ return Vector2D(
+ std::clamp(this->x, min.x, max.x == 0 ? INFINITY : max.x),
+ std::clamp(this->y, min.y, max.y == 0 ? INFINITY : max.y)
+ );
} \ No newline at end of file
diff --git a/src/helpers/Vector2D.hpp b/src/helpers/Vector2D.hpp
index 7288a088..7ca52a68 100644
--- a/src/helpers/Vector2D.hpp
+++ b/src/helpers/Vector2D.hpp
@@ -35,5 +35,7 @@ class Vector2D {
return a.x != x || a.y != y;
}
+ Vector2D clamp(const Vector2D& min, const Vector2D& max = Vector2D());
+
Vector2D floor();
}; \ No newline at end of file
diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp
index 33278053..ce2d7248 100644
--- a/src/helpers/WLClasses.hpp
+++ b/src/helpers/WLClasses.hpp
@@ -25,10 +25,14 @@ struct SLayerSurface {
int monitorID = -1;
+ std::string szNamespace = "";
+
CAnimatedVariable alpha;
bool fadingOut = false;
bool readyToDelete = false;
+ bool forceBlur = false;
+
// For the list lookup
bool operator==(const SLayerSurface& rhs) {
return layerSurface == rhs.layerSurface && monitorID == rhs.monitorID;
@@ -60,6 +64,26 @@ struct SRenderData {
// for custom round values
int rounding = -1; // -1 means not set
+
+ // for blurring
+ bool blur = false;
+
+ // for windows that animate poorly
+ bool squishOversized = false;
+};
+
+struct SExtensionFindingData {
+ Vector2D origin;
+ Vector2D vec;
+ wlr_surface** found;
+};
+
+struct SStringRuleNames {
+ std::string layout = "";
+ std::string model = "";
+ std::string variant = "";
+ std::string options = "";
+ std::string rules = "";
};
struct SKeyboard {
@@ -73,7 +97,7 @@ struct SKeyboard {
std::string name = "";
- xkb_rule_names currentRules = {0};
+ SStringRuleNames currentRules;
int repeatRate = 0;
int repeatDelay = 0;
int numlockOn = -1;
@@ -94,6 +118,8 @@ struct SMouse {
std::string name = "";
+ bool virt = false;
+
DYNLISTENER(commitConstraint);
DYNLISTENER(destroyMouse);
@@ -221,3 +247,25 @@ struct STabletPad {
return wlrTabletPadV2 == b.wlrTabletPadV2;
}
};
+
+struct SIdleInhibitor {
+ wlr_idle_inhibitor_v1* pWlrInhibitor = nullptr;
+ CWindow* pWindow = nullptr;
+
+ DYNLISTENER(Destroy);
+
+ bool operator==(const SIdleInhibitor& b) {
+ return pWlrInhibitor == b.pWlrInhibitor;
+ }
+};
+
+struct SSwipeGesture {
+ CWorkspace* pWorkspaceBegin = nullptr;
+
+ double delta = 0;
+
+ float avgSpeed = 0;
+ int speedPoints = 0;
+
+ SMonitor* pMonitor = nullptr;
+}; \ No newline at end of file
diff --git a/src/helpers/Workspace.hpp b/src/helpers/Workspace.hpp
index 2d0c5941..5a3a24ba 100644
--- a/src/helpers/Workspace.hpp
+++ b/src/helpers/Workspace.hpp
@@ -28,6 +28,7 @@ public:
// for animations
CAnimatedVariable m_vRenderOffset;
CAnimatedVariable m_fAlpha;
+ bool m_bForceRendering = false;
// "scratchpad"
bool m_bIsSpecialWorkspace = false;