#pragma once #define WLR_USE_UNSTABLE #include #include #include #include #include #include #include #include #include #include "globals.hpp" #define private public #include #undef private namespace Event { struct SCallbackInfo; } class COmarchyFloatingHyprBar : public IHyprWindowDecoration { public: COmarchyFloatingHyprBar(PHLWINDOW); virtual ~COmarchyFloatingHyprBar(); 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 onConfigReloaded(); WP m_self; private: SBoxExtents m_seExtents; PHLWINDOWREF m_pWindow; CBox m_bAssignedBox; SP m_pTextTex; bool m_bWindowSizeChanged = false; bool m_hidden = false; bool m_bTitleColorChanged = false; bool m_bButtonHovered = false; bool m_bLastEnabledState = false; bool m_bWindowHasFocus = false; std::optional m_bForcedBarColor; std::optional m_bForcedTitleColor; Time::steady_tp m_lastMouseDown{}; PHLANIMVAR m_cRealBarColor; Vector2D cursorRelativeToBar(); void renderPass(PHLMONITOR, float const &a); void renderBarTitle(const Vector2D &bufferSize, const float scale); void renderBarButtons(CBox *barBox, const float scale, const float a); void renderBarButtonsText(CBox *barBox, const float scale, const float a); void damageOnButtonHover(); bool inputIsValid(); void onMouseButton(Event::SCallbackInfo &info, IPointer::SButtonEvent e); void onTouchDown(Event::SCallbackInfo &info, ITouch::SDownEvent e); void onTouchUp(Event::SCallbackInfo &info, ITouch::SUpEvent e); void onMouseMove(Vector2D coords); void onTouchMove(Event::SCallbackInfo &info, ITouch::SMotionEvent e); void handleDownEvent(Event::SCallbackInfo &info, std::optional touchEvent); void handleUpEvent(Event::SCallbackInfo &info); void handleMovement(); bool doButtonPress(Config::INTEGER barPadding, Config::INTEGER barButtonPadding, Config::INTEGER barHeight, Vector2D COORDS, bool BUTTONSRIGHT); CBox assignedBoxGlobal(); CHyprSignalListener m_pMouseButtonCallback; CHyprSignalListener m_pTouchDownCallback; CHyprSignalListener m_pTouchUpCallback; CHyprSignalListener m_pTouchMoveCallback; CHyprSignalListener m_pMouseMoveCallback; std::string m_szLastTitle; bool m_bDraggingThis = false; bool m_bTouchEv = false; bool m_bDragPending = false; bool m_bCancelledDown = false; int m_touchId = 0; // store hover state for buttons as a bitfield unsigned int m_iButtonHoverState = 0; // for dynamic updates int m_iLastHeight = 0; size_t getVisibleButtonCount(Config::INTEGER barButtonPadding, Config::INTEGER barPadding, const Vector2D &bufferSize, const float scale); friend class COmarchyFloatingBarPassElement; };