summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2022-08-19 22:39:50 +0200
committerGitHub <noreply@github.com>2022-08-19 22:39:50 +0200
commit223ca6e2868b5a4d59bafecfa597e9b676226c4e (patch)
treeab31f800052cb865f4ac91016e5e4b574c63960e /src/helpers
parentc2a3896cc9168a12f25a144dada6ecb94fb52b59 (diff)
parentf0ad77251b28fcf48dcaf25f23e3a140d69a4735 (diff)
Merge pull request #548 from FlafyDev/main
add input:kb_file option to use a .xkb file.
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/MiscFunctions.cpp22
-rw-r--r--src/helpers/MiscFunctions.hpp3
-rw-r--r--src/helpers/WLClasses.hpp3
3 files changed, 26 insertions, 2 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index b7285637..b27489ca 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -40,6 +40,28 @@ static const float transforms[][9] = {{
},
};
+std::string absolutePath(const std::string& rawpath, const std::string& currentPath) {
+ auto value = rawpath;
+
+ if (value[0] == '.') {
+ auto currentDir = currentPath.substr(0, currentPath.find_last_of('/'));
+
+ if (value[1] == '.') {
+ auto parentDir = currentDir.substr(0, currentDir.find_last_of('/'));
+ value.replace(0, 2, parentDir);
+ } else {
+ value.replace(0, 1, currentDir);
+ }
+ }
+
+ if (value[0] == '~') {
+ static const char* const ENVHOME = getenv("HOME");
+ value.replace(0, 1, std::string(ENVHOME));
+ }
+
+ return value;
+}
+
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
ASSERT(pSignal);
ASSERT(pListener);
diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp
index a40471a9..9f002c20 100644
--- a/src/helpers/MiscFunctions.hpp
+++ b/src/helpers/MiscFunctions.hpp
@@ -2,6 +2,7 @@
#include "../includes.hpp"
+std::string absolutePath(const std::string&, const std::string&);
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, std::string ownerString);
void wlr_signal_emit_safe(struct wl_signal *signal, void *data);
std::string getFormat(const char *fmt, ...); // Basically Debug::log to a string
@@ -17,4 +18,4 @@ std::string execAndGet(const char*);
float getPlusMinusKeywordResult(std::string in, float relative);
-void matrixProjection(float mat[9], int w, int h, wl_output_transform tr); \ No newline at end of file
+void matrixProjection(float mat[9], int w, int h, wl_output_transform tr);
diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp
index 6b0787bb..4c769202 100644
--- a/src/helpers/WLClasses.hpp
+++ b/src/helpers/WLClasses.hpp
@@ -103,6 +103,7 @@ struct SKeyboard {
xkb_layout_index_t activeLayout = 0;
std::string name = "";
+ std::string xkbFilePath = "";
SStringRuleNames currentRules;
int repeatRate = 0;
@@ -316,4 +317,4 @@ struct SIMEPopup {
bool operator==(const SIMEPopup& other) {
return pSurface == other.pSurface;
}
-}; \ No newline at end of file
+};