#pragma once #define WLR_USE_UNSTABLE #include #include #include #include #include "globals.hpp" #define private public #include #undef private class CHyprBar : public IHyprWindowDecoration { public: CHyprBar(PHLWINDOW); virtual ~CHyprBar(); virtual SDecorationPositioningInfo getPositioningInfo(); virtual void onPositioningReply(const SDecorationPositioningReply& reply); virtual void draw(PHLMONITOR, float const& a); virtual eDecorationType getDecorationType(); virtual void updateWindow(PHLWINDOW); virtual void damageEntire(); virtual eDecorationLayer getDecorationLayer(); virtual uint64_t getDecorationFlags(); bool m_bButtonsDirty = true; virtual std::string getDisplayName(); PHLWINDOW getOwner(); void updateRules(); void applyRule(const SP&); private: SBoxExtents m_seExtents; PHLWINDOWREF m_pWindow; CBox m_bAssignedBox; SP m_pTextTex; SP m_pButtonsTex; bool m_bWindowSizeChanged = false; bool m_bHidden = false; bool m_bTitleColorChanged = false; std::optional m_bForcedBarColor; std::optional m_bForcedTitleColor; Vector2D cursorRelativeToBar(); void renderPass(PHLMONITOR, float const& a); void renderBarTitle(const Vector2D& bufferSize, const float scale); void renderText(SP out, const std::string& text, const CHyprColor& color, const Vector2D& bufferSize, const float scale, const int fontSize); void renderBarButtons(const Vector2D& bufferSize, const float scale); void renderBarButtonsText(CBox* barBox, const float scale, const float a); bool inputIsValid(); void onMouseButton(SCallbackInfo& info, IPointer::SButtonEvent e); void onTouchDown(SCallbackInfo& info, ITouch::SDownEvent e); void onMouseMove(Vector2D coords); void onTouchMove(SCallbackInfo& info, ITouch::SMotionEvent e); void handleDownEvent(SCallbackInfo& info, std::optional touchEvent); void handleUpEvent(SCallbackInfo& info); void handleMovement(); void doButtonPress(long int* const* PBARPADDING, long int* const* PBARBUTTONPADDING, long int* const* PHEIGHT, Vector2D COORDS, bool BUTTONSRIGHT); CBox assignedBoxGlobal(); SP m_pMouseButtonCallback; SP m_pTouchDownCallback; SP m_pTouchUpCallback; SP m_pTouchMoveCallback; SP m_pMouseMoveCallback; std::string m_szLastTitle; bool m_bDraggingThis = false; bool m_bTouchEv = false; bool m_bDragPending = false; bool m_bCancelledDown = false; // for dynamic updates int m_iLastHeight = 0; size_t getVisibleButtonCount(long int* const* PBARBUTTONPADDING, long int* const* PBARPADDING, const Vector2D& bufferSize, const float scale); friend class CBarPassElement; };