2024-04-03 20:14:34 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#define WLR_USE_UNSTABLE
|
|
|
|
|
|
|
|
#include "globals.hpp"
|
|
|
|
#include <hyprland/src/desktop/DesktopTypes.hpp>
|
|
|
|
#include <hyprland/src/render/Framebuffer.hpp>
|
|
|
|
#include <hyprland/src/helpers/AnimatedVariable.hpp>
|
|
|
|
#include <hyprland/src/managers/HookSystemManager.hpp>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
// saves on resources, but is a bit broken rn with blur.
|
|
|
|
// hyprland's fault, but cba to fix.
|
|
|
|
constexpr bool ENABLE_LOWRES = false;
|
|
|
|
|
|
|
|
class CMonitor;
|
|
|
|
|
|
|
|
class COverview {
|
|
|
|
public:
|
|
|
|
COverview(PHLWORKSPACE startedOn_, bool swipe = false);
|
|
|
|
~COverview();
|
|
|
|
|
|
|
|
void render();
|
|
|
|
void damage();
|
|
|
|
void onDamageReported();
|
|
|
|
void onPreRender();
|
|
|
|
|
|
|
|
void onSwipeUpdate(double delta);
|
|
|
|
void onSwipeEnd();
|
|
|
|
|
|
|
|
// close without a selection
|
2024-10-21 20:17:02 +02:00
|
|
|
void close();
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-10-21 20:17:02 +02:00
|
|
|
bool blockOverviewRendering = false;
|
|
|
|
bool blockDamageReporting = false;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-10-21 20:17:02 +02:00
|
|
|
PHLMONITORREF pMonitor;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
|
|
|
private:
|
2024-12-04 15:58:09 +01:00
|
|
|
void redrawID(int id, bool forcelowres = false);
|
|
|
|
void redrawAll(bool forcelowres = false);
|
|
|
|
void onWorkspaceChange();
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-12-04 15:58:09 +01:00
|
|
|
int SIDE_LENGTH = 3;
|
|
|
|
int GAP_WIDTH = 5;
|
|
|
|
CHyprColor BG_COLOR = CHyprColor{0.1, 0.1, 0.1, 1.0};
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-12-04 15:58:09 +01:00
|
|
|
bool damageDirty = false;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
|
|
|
struct SWorkspaceImage {
|
|
|
|
CFramebuffer fb;
|
|
|
|
int64_t workspaceID = -1;
|
|
|
|
PHLWORKSPACE pWorkspace;
|
|
|
|
CBox box;
|
|
|
|
};
|
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
Vector2D lastMousePosLocal = Vector2D{};
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
int openedID = -1;
|
|
|
|
int closeOnID = -1;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
std::vector<SWorkspaceImage> images;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
PHLWORKSPACE startedOn;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
CAnimatedVariable<Vector2D> size;
|
|
|
|
CAnimatedVariable<Vector2D> pos;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
bool closing = false;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
SP<HOOK_CALLBACK_FN> mouseMoveHook;
|
|
|
|
SP<HOOK_CALLBACK_FN> mouseButtonHook;
|
|
|
|
SP<HOOK_CALLBACK_FN> touchMoveHook;
|
2024-11-14 22:28:54 +01:00
|
|
|
SP<HOOK_CALLBACK_FN> touchDownHook;
|
2024-04-03 20:14:34 +02:00
|
|
|
|
2024-05-08 14:48:33 +02:00
|
|
|
bool swipe = false;
|
|
|
|
bool swipeWasCommenced = false;
|
2024-04-03 20:14:34 +02:00
|
|
|
};
|
|
|
|
|
2024-12-04 15:58:09 +01:00
|
|
|
inline std::unique_ptr<COverview> g_pOverview;
|