hyprpicker/src/hyprpicker.hpp

71 lines
2.5 KiB
C++
Raw Normal View History

2022-09-02 18:06:00 +02:00
#pragma once
#include "defines.hpp"
#include "helpers/LayerSurface.hpp"
#include "helpers/PoolBuffer.hpp"
enum eOutputMode
{
OUTPUT_CMYK = 0,
OUTPUT_HEX,
OUTPUT_RGB,
OUTPUT_HSL,
OUTPUT_HSV
2022-09-02 20:44:42 +02:00
};
2022-09-02 18:06:00 +02:00
class CHyprpicker {
public:
void init();
2022-09-02 18:06:00 +02:00
std::mutex m_mtTickMutex;
2022-09-02 18:06:00 +02:00
wl_compositor* m_pCompositor;
wl_display* m_pWLDisplay;
wl_registry* m_pWLRegistry;
wl_shm* m_pWLSHM;
zwlr_layer_shell_v1* m_pLayerShell;
zwlr_screencopy_manager_v1* m_pSCMgr;
2022-09-02 18:06:00 +02:00
eOutputMode m_bSelectedOutputMode = OUTPUT_HEX;
2022-09-02 20:44:42 +02:00
bool m_bFancyOutput = true;
2022-09-02 21:14:44 +02:00
bool m_bAutoCopy = false;
bool m_bRenderInactive = false;
bool m_bNoZoom = false;
bool m_bRunning = true;
2022-09-02 18:06:00 +02:00
std::vector<std::unique_ptr<SMonitor>> m_vMonitors;
2022-09-02 18:06:00 +02:00
std::vector<std::unique_ptr<CLayerSurface>> m_vLayerSurfaces;
void createSeat(wl_seat*);
2022-09-02 18:06:00 +02:00
CLayerSurface* m_pLastSurface;
2022-09-02 18:06:00 +02:00
Vector2D m_vLastCoords;
2022-09-02 18:06:00 +02:00
void renderSurface(CLayerSurface*, bool forceInactive = false);
2022-09-02 18:06:00 +02:00
void createBuffer(SPoolBuffer*, int32_t, int32_t, uint32_t, uint32_t);
void destroyBuffer(SPoolBuffer*);
int createPoolFile(size_t, std::string&);
bool setCloexec(const int&);
void recheckACK();
2022-09-02 18:06:00 +02:00
void sendFrame(CLayerSurface*);
2022-09-02 18:06:00 +02:00
SPoolBuffer* getBufferForLS(CLayerSurface*);
2022-09-02 18:06:00 +02:00
void convertBuffer(SPoolBuffer*);
2022-09-02 18:06:00 +02:00
void markDirty();
2022-09-02 18:06:00 +02:00
void finish(int code = 0);
2022-09-02 18:06:00 +02:00
CColor getColorFromPixel(CLayerSurface*, Vector2D);
2022-09-02 19:39:47 +02:00
private:
2022-09-02 18:06:00 +02:00
};
inline std::unique_ptr<CHyprpicker> g_pHyprpicker;