2022-09-02 18:06:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "defines.hpp"
|
|
|
|
#include "helpers/LayerSurface.hpp"
|
|
|
|
#include "helpers/PoolBuffer.hpp"
|
|
|
|
|
2024-03-23 21:50:44 +01:00
|
|
|
enum eOutputMode {
|
Support HSL, HSV, CMYK, short options, minor I/O fix, and add a manual page (#12)
* use getopt_long(3) and support short options
Now instead of `--format`, `--no-fancy`, and `--help` you can also use
`-f`, `-n`, and `-h`. Additionally instead of just being able to do
`--format <fmt>` you can now do the standard `--format=<fmt>`.
* remove initial space when m_bFancyOutput is true
* add the HSL format
* add the HSV format
* add a manual page
* silence compiler warning
* make all the default target, and add install rule
* add the CMYK format
* add new formats to the README
2022-11-19 18:02:11 +01:00
|
|
|
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 {
|
2023-03-31 18:41:40 +02:00
|
|
|
public:
|
|
|
|
void init();
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
std::mutex m_mtTickMutex;
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2024-09-26 13:58:43 +02:00
|
|
|
SP<CCWlCompositor> m_pCompositor;
|
|
|
|
SP<CCWlRegistry> m_pRegistry;
|
|
|
|
SP<CCWlShm> m_pSHM;
|
|
|
|
SP<CCZwlrLayerShellV1> m_pLayerShell;
|
|
|
|
SP<CCZwlrScreencopyManagerV1> m_pScreencopyMgr;
|
|
|
|
SP<CCWpCursorShapeManagerV1> m_pCursorShapeMgr;
|
|
|
|
SP<CCWpCursorShapeDeviceV1> m_pCursorShapeDevice;
|
|
|
|
SP<CCWlSeat> m_pSeat;
|
|
|
|
SP<CCWlKeyboard> m_pKeyboard;
|
|
|
|
SP<CCWlPointer> m_pPointer;
|
|
|
|
wl_display* m_pWLDisplay = nullptr;
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-10-11 12:24:10 +02:00
|
|
|
xkb_context* m_pXKBContext = nullptr;
|
|
|
|
xkb_keymap* m_pXKBKeymap = nullptr;
|
|
|
|
xkb_state* m_pXKBState = nullptr;
|
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
eOutputMode m_bSelectedOutputMode = OUTPUT_HEX;
|
2022-09-02 20:44:42 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
bool m_bFancyOutput = true;
|
2022-09-02 21:14:44 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
bool m_bAutoCopy = false;
|
|
|
|
bool m_bRenderInactive = false;
|
|
|
|
bool m_bNoZoom = false;
|
2022-11-19 15:53:05 +01:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
bool m_bRunning = true;
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +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;
|
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
CLayerSurface* m_pLastSurface;
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
Vector2D m_vLastCoords;
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
void renderSurface(CLayerSurface*, bool forceInactive = false);
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
int createPoolFile(size_t, std::string&);
|
|
|
|
bool setCloexec(const int&);
|
|
|
|
void recheckACK();
|
2024-09-26 13:58:43 +02:00
|
|
|
void initKeyboard();
|
|
|
|
void initMouse();
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2024-09-26 13:58:43 +02:00
|
|
|
SP<SPoolBuffer> getBufferForLS(CLayerSurface*);
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2024-09-26 13:58:43 +02:00
|
|
|
void convertBuffer(SP<SPoolBuffer>);
|
|
|
|
void* convert24To32Buffer(SP<SPoolBuffer>);
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
void markDirty();
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
void finish(int code = 0);
|
2022-09-02 18:06:00 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
CColor getColorFromPixel(CLayerSurface*, Vector2D);
|
2022-09-02 19:39:47 +02:00
|
|
|
|
2023-03-31 18:41:40 +02:00
|
|
|
private:
|
2022-09-02 18:06:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline std::unique_ptr<CHyprpicker> g_pHyprpicker;
|