2024-02-29 15:26:02 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
#include "Subsurface.hpp"
|
|
|
|
|
|
|
|
class CPopup {
|
|
|
|
public:
|
|
|
|
// dummy head nodes
|
2024-04-27 13:43:12 +02:00
|
|
|
CPopup(PHLWINDOW pOwner);
|
2024-04-30 03:41:27 +02:00
|
|
|
CPopup(PHLLS pOwner);
|
2024-02-29 15:26:02 +01:00
|
|
|
|
|
|
|
// real nodes
|
|
|
|
CPopup(wlr_xdg_popup* popup, CPopup* pOwner);
|
|
|
|
|
|
|
|
~CPopup();
|
|
|
|
|
|
|
|
Vector2D coordsRelativeToParent();
|
|
|
|
Vector2D coordsGlobal();
|
|
|
|
|
2024-02-29 16:07:11 +01:00
|
|
|
Vector2D size();
|
|
|
|
|
2024-02-29 15:26:02 +01:00
|
|
|
void onNewPopup(wlr_xdg_popup* popup);
|
|
|
|
void onDestroy();
|
|
|
|
void onMap();
|
|
|
|
void onUnmap();
|
2024-03-15 16:55:24 +01:00
|
|
|
void onCommit(bool ignoreSiblings = false);
|
2024-02-29 15:26:02 +01:00
|
|
|
void onReposition();
|
|
|
|
|
|
|
|
void recheckTree();
|
|
|
|
|
2024-05-05 00:46:10 +02:00
|
|
|
bool visible();
|
|
|
|
|
2024-02-29 15:26:02 +01:00
|
|
|
CWLSurface m_sWLSurface;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// T1 owners, each popup has to have one of these
|
2024-04-30 03:41:27 +02:00
|
|
|
PHLWINDOWREF m_pWindowOwner;
|
2024-05-05 00:46:10 +02:00
|
|
|
PHLLSREF m_pLayerOwner;
|
2024-02-29 15:26:02 +01:00
|
|
|
|
|
|
|
// T2 owners
|
|
|
|
CPopup* m_pParent = nullptr;
|
|
|
|
|
|
|
|
wlr_xdg_popup* m_pWLR = nullptr;
|
|
|
|
|
|
|
|
Vector2D m_vLastSize = {};
|
|
|
|
Vector2D m_vLastPos = {};
|
|
|
|
|
|
|
|
bool m_bRequestedReposition = false;
|
|
|
|
|
|
|
|
bool m_bInert = false;
|
|
|
|
|
|
|
|
//
|
|
|
|
std::vector<std::unique_ptr<CPopup>> m_vChildren;
|
|
|
|
std::unique_ptr<CSubsurface> m_pSubsurfaceHead;
|
|
|
|
|
|
|
|
// signals
|
|
|
|
DYNLISTENER(newPopup);
|
|
|
|
DYNLISTENER(destroyPopup);
|
|
|
|
DYNLISTENER(mapPopup);
|
|
|
|
DYNLISTENER(unmapPopup);
|
|
|
|
DYNLISTENER(commitPopup);
|
|
|
|
DYNLISTENER(repositionPopup);
|
|
|
|
|
|
|
|
void initAllSignals();
|
|
|
|
void unconstrain();
|
|
|
|
void recheckChildrenRecursive();
|
2024-03-05 21:42:22 +01:00
|
|
|
void sendScale();
|
2024-02-29 15:26:02 +01:00
|
|
|
|
|
|
|
Vector2D localToGlobal(const Vector2D& rel);
|
|
|
|
Vector2D t1ParentCoords();
|
|
|
|
};
|