-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathHyprexpoLogic.hpp
More file actions
134 lines (109 loc) · 4.3 KB
/
Copy pathHyprexpoLogic.hpp
File metadata and controls
134 lines (109 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#pragma once
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
namespace Hyprexpo {
struct SColorRGBA {
float r = 0.F;
float g = 0.F;
float b = 0.F;
float a = 1.F;
};
struct SGradientSpec {
SColorRGBA c1;
SColorRGBA c2;
float angleDeg = 0.F;
bool valid = false;
};
enum class EWorkspaceMethodMode {
Center,
First,
};
enum class ENumberKeyMode {
Workspace,
Index,
Passthrough,
};
struct SWorkspaceMethodSpec {
bool valid = false;
EWorkspaceMethodMode mode = EWorkspaceMethodMode::Center;
std::string workspace;
std::string error;
};
struct SPoint {
double x = 0.0;
double y = 0.0;
};
struct SSize {
double w = 0.0;
double h = 0.0;
};
struct SRect {
double x = 0.0;
double y = 0.0;
double w = 0.0;
double h = 0.0;
};
struct SGridShape {
int cols = 1;
int rows = 1;
};
struct STileLayout {
SRect box;
int row = -1;
int col = -1;
};
struct SDropIntentInput {
bool targetValid = false;
SPoint pointerLocal = {};
SRect targetTileLocal = {};
SSize workspaceSize = {};
SSize windowSize = {};
SPoint grabOffset = {};
double minProxySize = 24.0;
};
struct SDropIntentGeometry {
bool valid = false;
SPoint targetWorkspacePoint = {};
SRect targetProxyLocal = {};
};
struct SGestureConfig {
int fingers = 0;
std::string direction;
bool directionValid = false;
};
struct SGestureSyncDecision {
bool registerGesture = false;
std::string error;
};
std::string trimString(std::string value);
std::string lowerString(std::string value);
std::vector<std::string> splitCommaList(const std::string& value);
SGridShape computeDynamicGridShape(int visibleCount);
std::optional<std::vector<int64_t>> expandDynamicWorkspaceIDs(const std::vector<int64_t>& workspaceIDs, bool fillGaps, std::size_t maxExpandedWorkspaces);
SSize aspectCorrectTileSize(double screenW, double screenH, int cols, int rows, double gap);
STileLayout computeTileLayout(int index, int visibleCount, SGridShape shape, SSize total, double gap, bool centerPartialRows);
int tileIndexAtPoint(double x, double y, int visibleCount, SGridShape shape, SSize total, double gap, bool centerPartialRows);
int clampGridColumns(int columns);
int gridColumnsToIncludeWorkspace(int configuredColumns, int firstWorkspaceID, int activeWorkspaceID, int maxColumns);
int tileIndexFromPoint(double x, double y, double width, double height, int sideLength);
int numberKeyToVisibleIndex(int number);
ENumberKeyMode numberKeyModeFromString(const std::string& mode);
SDropIntentGeometry computeDropIntentGeometry(const SDropIntentInput& input);
SGestureSyncDecision evaluateGestureSync(const SGestureConfig& config);
std::string decodeConfigString(const void* dataptr, bool underlyingIsStdString, const std::string& fallback);
std::string fallbackTokenForVisibleIndex(int visibleIndex);
int fallbackTokenToVisibleIndex(const std::string& token);
bool parseHexRGBA8(const std::string& value, SColorRGBA& out);
bool parseSolidColorSpec(const std::string& value, SColorRGBA& out);
SGradientSpec parseGradientSpec(const std::string& value);
bool isGradientBorderSpec(const std::string& value);
bool shouldShowWorkspaceLabel(bool labelEnabled, const std::string& labelShow, bool isHovered, bool isFocused, bool isCurrent);
std::string resolveBorderSpec(const std::string& modernSpec, const std::string& legacySpec);
std::string resolveLabelPosition(const std::string& modernValue, bool modernSetByUser, const std::string& legacyValue, bool legacySetByUser);
int resolveLabelFontSize(int modernValue, bool modernSetByUser, int legacyValue, bool legacySetByUser);
SWorkspaceMethodSpec parseWorkspaceMethodSpec(const std::string& method);
SWorkspaceMethodSpec resolveWorkspaceMethodForMonitor(const std::string& config, const std::string& monitorName);
}