2022-03-28 16:10:30 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-10-23 00:11:03 +02:00
|
|
|
#include <optional>
|
2023-08-07 13:35:19 +02:00
|
|
|
#include <string>
|
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <wlr/util/box.h>
|
|
|
|
#include "Vector2D.hpp"
|
2023-08-11 17:22:16 +02:00
|
|
|
#include <vector>
|
2023-09-06 12:51:36 +02:00
|
|
|
#include <format>
|
2022-03-28 16:10:30 +02:00
|
|
|
|
2023-08-11 17:22:16 +02:00
|
|
|
struct SCallstackFrameInfo {
|
|
|
|
void* adr = nullptr;
|
|
|
|
std::string desc;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::string absolutePath(const std::string&, const std::string&);
|
|
|
|
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString);
|
2024-01-19 16:20:22 +01:00
|
|
|
void removeWLSignal(wl_listener*);
|
2023-08-11 17:22:16 +02:00
|
|
|
std::string escapeJSONStrings(const std::string& str);
|
|
|
|
bool isDirection(const std::string&);
|
2023-11-05 17:18:41 +01:00
|
|
|
bool isDirection(const char&);
|
2023-08-11 17:22:16 +02:00
|
|
|
int getWorkspaceIDFromString(const std::string&, std::string&);
|
2023-10-23 00:11:03 +02:00
|
|
|
std::optional<std::string> cleanCmdForWorkspace(const std::string&, std::string);
|
2023-08-11 17:22:16 +02:00
|
|
|
float vecToRectDistanceSquared(const Vector2D& vec, const Vector2D& p1, const Vector2D& p2);
|
|
|
|
void logSystemInfo();
|
|
|
|
std::string execAndGet(const char*);
|
|
|
|
int64_t getPPIDof(int64_t pid);
|
|
|
|
int64_t configStringToInt(const std::string&);
|
2024-03-08 03:24:44 +01:00
|
|
|
Vector2D configStringToVector2D(const std::string&);
|
2023-11-12 14:40:02 +01:00
|
|
|
std::optional<float> getPlusMinusKeywordResult(std::string in, float relative);
|
2023-08-11 17:22:16 +02:00
|
|
|
void matrixProjection(float mat[9], int w, int h, wl_output_transform tr);
|
|
|
|
double normalizeAngleRad(double ang);
|
2023-08-20 11:47:06 +02:00
|
|
|
std::vector<SCallstackFrameInfo> getBacktrace();
|
2023-09-06 12:51:36 +02:00
|
|
|
void throwError(const std::string& err);
|
2023-12-21 22:27:12 +01:00
|
|
|
bool envEnabled(const std::string& env);
|
2024-05-01 17:41:17 +02:00
|
|
|
int allocateSHMFile(size_t len);
|
2024-06-08 10:07:59 +02:00
|
|
|
bool allocateSHMFilePair(size_t size, int* rw_fd_ptr, int* ro_fd_ptr);
|
2023-09-06 12:51:36 +02:00
|
|
|
|
|
|
|
template <typename... Args>
|
2023-09-20 09:26:20 +02:00
|
|
|
[[deprecated("use std::format instead")]] std::string getFormat(std::format_string<Args...> fmt, Args&&... args) {
|
|
|
|
// no need for try {} catch {} because std::format_string<Args...> ensures that vformat never throw std::format_error
|
|
|
|
// because any suck format specifier will cause a compilation error
|
|
|
|
// this is actually what std::format in stdlib does
|
|
|
|
return std::vformat(fmt.get(), std::make_format_args(args...));
|
2023-09-06 12:51:36 +02:00
|
|
|
}
|