From 44aeb1fc909ec9cb3e6b82a5397e9eec8839192b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 26 Jun 2022 22:15:06 +0200 Subject: added decoration:shadow_offset --- src/helpers/MiscFunctions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/helpers/MiscFunctions.cpp') diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index ce9dd788..d082799f 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -135,8 +135,8 @@ float getPlusMinusKeywordResult(std::string source, float relative) { return result; } -bool isNumber(const std::string& str) { - return std::ranges::all_of(str.begin(), str.end(), [](char c) { return isdigit(c) != 0 || c == '-'; }); +bool isNumber(const std::string& str, bool allowfloat) { + return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); }); } bool isDirection(const std::string& arg) { -- cgit v1.2.3 From 8b4a373efa01ce2c685734cf85237456f8885944 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 28 Jun 2022 11:30:07 +0200 Subject: update wlroots dep --- src/helpers/MiscFunctions.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'src/helpers/MiscFunctions.cpp') diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index d082799f..d5eece67 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -4,6 +4,41 @@ #include "../Compositor.hpp" #include +static const float transforms[][9] = {{ + 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + },{ + 0.0f, 1.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + },{ + -1.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + },{ + 0.0f, -1.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + },{ + -1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + },{ + 0.0f, 1.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + },{ + 1.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + },{ + 0.0f, -1.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + }, +}; + void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) { ASSERT(pSignal); ASSERT(pListener); @@ -264,4 +299,25 @@ void logSystemInfo() { Debug::log(LOG, "os-release:"); Debug::log(NONE, "%s", execAndGet("cat /etc/os-release").c_str()); -} \ No newline at end of file +} + +void matrixProjection(float mat[9], int w, int h, wl_output_transform tr) { + memset(mat, 0, sizeof(*mat) * 9); + + const float* t = transforms[tr]; + float x = 2.0f / w; + float y = 2.0f / h; + + // Rotation + reflection + mat[0] = x * t[0]; + mat[1] = x * t[1]; + mat[3] = y * -t[3]; + mat[4] = y * -t[4]; + + // Translation + mat[2] = -copysign(1.0f, mat[0] + mat[1]); + mat[5] = -copysign(1.0f, mat[3] + mat[4]); + + // Identity + mat[8] = 1.0f; +} -- cgit v1.2.3 From 328b3fa4bc4f3776f2128f84709556569c4824d9 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 30 Jun 2022 15:44:26 +0200 Subject: mordernize pointers --- src/helpers/MiscFunctions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/helpers/MiscFunctions.cpp') diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index d5eece67..067a351f 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -219,12 +219,12 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) { int lowestID = 99999; int highestID = -99999; - for (auto& w : g_pCompositor->m_lWorkspaces) { - if (w.m_iID < lowestID) - lowestID = w.m_iID; + for (auto& w : g_pCompositor->m_vWorkspaces) { + if (w->m_iID < lowestID) + lowestID = w->m_iID; - if (w.m_iID > highestID) - highestID = w.m_iID; + if (w->m_iID > highestID) + highestID = w->m_iID; } if (remains < 0) -- cgit v1.2.3 From 4510764f348d1a7c4cca613925ee22acfa38b388 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 30 Jun 2022 20:02:04 +0200 Subject: finally fix scaled snapshots --- src/helpers/MiscFunctions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/helpers/MiscFunctions.cpp') diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 067a351f..cb1d88d6 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -114,8 +114,8 @@ std::string getFormat(const char *fmt, ...) { } void scaleBox(wlr_box* box, float scale) { - box->width = std::round((box->x + box->width) * scale) - std::round(box->x * scale); - box->height = std::round((box->y + box->height) * scale) - std::round(box->y * scale); + box->width = std::round(box->width * scale); + box->height = std::round(box->height * scale); box->x = std::round(box->x * scale); box->y = std::round(box->y * scale); } -- cgit v1.2.3