hyprland-plugins/hyprbars/barDeco.hpp

56 lines
1.7 KiB
C++
Raw Normal View History

2023-02-28 21:30:51 +01:00
#pragma once
#define WLR_USE_UNSTABLE
2023-05-01 03:57:48 +02:00
#include <hyprland/src/render/decorations/IHyprWindowDecoration.hpp>
#include <hyprland/src/render/OpenGL.hpp>
2023-02-28 22:59:58 +01:00
#include "globals.hpp"
2023-02-28 21:30:51 +01:00
class CHyprBar : public IHyprWindowDecoration {
public:
CHyprBar(CWindow*);
virtual ~CHyprBar();
virtual SWindowDecorationExtents getWindowDecorationExtents();
virtual void draw(CMonitor*, float a, const Vector2D& offset);
virtual eDecorationType getDecorationType();
virtual void updateWindow(CWindow*);
virtual void damageEntire();
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
2023-02-28 23:53:49 +01:00
virtual bool allowsInput();
2023-02-28 21:30:51 +01:00
private:
SWindowDecorationExtents m_seExtents;
CWindow* m_pWindow = nullptr;
Vector2D m_vLastWindowPos;
Vector2D m_vLastWindowSize;
CTexture m_tTextTex;
2023-02-28 22:59:58 +01:00
CTexture m_tButtonsTex;
2023-02-28 21:30:51 +01:00
2023-02-28 22:17:46 +01:00
bool m_bWindowSizeChanged = false;
2023-02-28 22:59:58 +01:00
Vector2D cursorRelativeToBar();
void renderBarTitle(const Vector2D& bufferSize, const float scale);
void renderBarButtons(const Vector2D& bufferSize, const float scale);
2023-02-28 22:59:58 +01:00
void onMouseDown(wlr_pointer_button_event* e);
2023-02-28 23:53:49 +01:00
void onMouseMove(Vector2D coords);
2023-02-28 22:59:58 +01:00
HOOK_CALLBACK_FN* m_pMouseButtonCallback;
2023-02-28 23:53:49 +01:00
HOOK_CALLBACK_FN* m_pMouseMoveCallback;
2023-02-28 22:59:58 +01:00
2023-02-28 21:30:51 +01:00
std::string m_szLastTitle;
2023-02-28 23:53:49 +01:00
bool m_bDraggingThis = false;
bool m_bDragPending = false;
};