2022-03-17 20:22:29 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "defines.hpp"
|
|
|
|
#include "events/Events.hpp"
|
2022-03-27 21:46:27 +02:00
|
|
|
#include "helpers/SubsurfaceTree.hpp"
|
2022-04-23 14:16:02 +02:00
|
|
|
#include "helpers/AnimatedVariable.hpp"
|
2022-05-28 20:46:20 +02:00
|
|
|
#include "render/decorations/IHyprWindowDecoration.hpp"
|
|
|
|
#include <deque>
|
2022-03-17 20:22:29 +01:00
|
|
|
|
2022-04-22 14:37:38 +02:00
|
|
|
struct SWindowSpecialRenderData {
|
|
|
|
float alpha = 1.f;
|
2022-05-31 17:35:50 +02:00
|
|
|
float alphaInactive = -1.f; // -1 means unset
|
2022-04-22 14:37:38 +02:00
|
|
|
};
|
2022-03-17 20:22:29 +01:00
|
|
|
|
2022-05-15 14:18:31 +02:00
|
|
|
struct SWindowAdditionalConfigData {
|
|
|
|
std::string animationStyle = "";
|
2022-05-28 17:48:01 +02:00
|
|
|
int rounding = -1; // -1 means no
|
2022-06-24 22:28:54 +02:00
|
|
|
bool forceNoBlur = false;
|
2022-05-15 14:18:31 +02:00
|
|
|
};
|
|
|
|
|
2022-03-17 20:22:29 +01:00
|
|
|
class CWindow {
|
|
|
|
public:
|
2022-04-23 14:16:02 +02:00
|
|
|
CWindow();
|
2022-03-30 21:18:42 +02:00
|
|
|
~CWindow();
|
|
|
|
|
2022-03-17 20:22:29 +01:00
|
|
|
DYNLISTENER(commitWindow);
|
|
|
|
DYNLISTENER(mapWindow);
|
|
|
|
DYNLISTENER(unmapWindow);
|
|
|
|
DYNLISTENER(destroyWindow);
|
|
|
|
DYNLISTENER(setTitleWindow);
|
|
|
|
DYNLISTENER(fullscreenWindow);
|
2022-03-20 14:00:46 +01:00
|
|
|
DYNLISTENER(newPopupXDG);
|
2022-03-27 17:25:20 +02:00
|
|
|
// DYNLISTENER(newSubsurfaceWindow);
|
2022-03-17 20:22:29 +01:00
|
|
|
|
|
|
|
union {
|
|
|
|
wlr_xdg_surface* xdg;
|
|
|
|
wlr_xwayland_surface* xwayland;
|
|
|
|
} m_uSurface;
|
|
|
|
|
|
|
|
// this is the position and size of the "bounding box"
|
|
|
|
Vector2D m_vPosition = Vector2D(0,0);
|
|
|
|
Vector2D m_vSize = Vector2D(0,0);
|
|
|
|
|
|
|
|
// this is the real position and size used to draw the thing
|
2022-04-23 14:16:02 +02:00
|
|
|
CAnimatedVariable m_vRealPosition;
|
|
|
|
CAnimatedVariable m_vRealSize;
|
2022-03-17 20:22:29 +01:00
|
|
|
|
2022-04-02 20:04:32 +02:00
|
|
|
// this is used for pseudotiling
|
|
|
|
bool m_bIsPseudotiled = false;
|
|
|
|
Vector2D m_vPseudoSize = Vector2D(0,0);
|
|
|
|
|
2022-03-17 20:22:29 +01:00
|
|
|
uint64_t m_iTags = 0;
|
|
|
|
bool m_bIsFloating = false;
|
2022-04-03 13:49:21 +02:00
|
|
|
bool m_bDraggingTiled = false; // for dragging around tiled windows
|
2022-03-17 20:22:29 +01:00
|
|
|
bool m_bIsFullscreen = false;
|
|
|
|
uint64_t m_iMonitorID = -1;
|
2022-03-18 22:35:51 +01:00
|
|
|
std::string m_szTitle = "";
|
2022-03-20 15:55:47 +01:00
|
|
|
int m_iWorkspaceID = -1;
|
2022-03-18 20:03:39 +01:00
|
|
|
|
2022-03-22 20:53:11 +01:00
|
|
|
bool m_bIsMapped = false;
|
|
|
|
|
2022-05-26 19:05:32 +02:00
|
|
|
bool m_bRequestsFloat = false;
|
|
|
|
|
2022-03-30 20:16:23 +02:00
|
|
|
// This is for fullscreen apps
|
|
|
|
bool m_bCreatedOverFullscreen = false;
|
|
|
|
|
2022-03-18 20:03:39 +01:00
|
|
|
// XWayland stuff
|
|
|
|
bool m_bIsX11 = false;
|
2022-03-18 23:16:15 +01:00
|
|
|
bool m_bMappedX11 = false;
|
2022-06-30 15:44:26 +02:00
|
|
|
CWindow* m_pX11Parent = nullptr;
|
2022-03-18 20:03:39 +01:00
|
|
|
uint64_t m_iX11Type = 0;
|
2022-03-22 18:29:13 +01:00
|
|
|
bool m_bIsModal = false;
|
2022-03-22 21:28:57 +01:00
|
|
|
bool m_bX11DoesntWantBorders = false;
|
2022-03-18 20:03:39 +01:00
|
|
|
DYNLISTENER(activateX11);
|
|
|
|
DYNLISTENER(configureX11);
|
|
|
|
//
|
2022-03-18 22:35:51 +01:00
|
|
|
|
2022-05-14 14:37:57 +02:00
|
|
|
// For nofocus
|
|
|
|
bool m_bNoFocus = false;
|
2022-06-26 20:08:19 +02:00
|
|
|
bool m_bNoInitialFocus = false;
|
2022-05-14 14:37:57 +02:00
|
|
|
|
2022-03-27 21:46:27 +02:00
|
|
|
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
|
|
|
|
|
2022-03-31 17:50:00 +02:00
|
|
|
// Animated border
|
2022-04-23 14:16:02 +02:00
|
|
|
CAnimatedVariable m_cRealBorderColor;
|
2022-03-31 17:50:00 +02:00
|
|
|
|
2022-04-05 19:28:10 +02:00
|
|
|
// Fade in-out
|
2022-04-23 14:16:02 +02:00
|
|
|
CAnimatedVariable m_fAlpha;
|
2022-04-05 19:28:10 +02:00
|
|
|
bool m_bFadingOut = false;
|
2022-04-10 11:17:06 +02:00
|
|
|
bool m_bReadyToDelete = false;
|
2022-05-28 18:28:55 +02:00
|
|
|
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
|
|
|
|
Vector2D m_vOriginalClosedSize; // drawing the closing animations
|
2022-04-05 19:28:10 +02:00
|
|
|
|
2022-04-12 16:44:18 +02:00
|
|
|
// For hidden windows and stuff
|
|
|
|
bool m_bHidden = false;
|
|
|
|
|
2022-05-29 11:24:42 +02:00
|
|
|
// Foreign Toplevel proto
|
|
|
|
wlr_foreign_toplevel_handle_v1* m_phForeignToplevel = nullptr;
|
|
|
|
|
2022-05-28 20:46:20 +02:00
|
|
|
// Window decorations
|
2022-05-28 23:43:11 +02:00
|
|
|
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
|
2022-07-05 17:31:47 +02:00
|
|
|
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
|
2022-05-28 20:46:20 +02:00
|
|
|
|
2022-04-22 14:37:38 +02:00
|
|
|
// Special render data, rules, etc
|
|
|
|
SWindowSpecialRenderData m_sSpecialRenderData;
|
2022-05-15 14:18:31 +02:00
|
|
|
SWindowAdditionalConfigData m_sAdditionalConfigData;
|
2022-03-18 22:35:51 +01:00
|
|
|
|
|
|
|
// For the list lookup
|
|
|
|
bool operator==(const CWindow& rhs) {
|
2022-04-23 14:16:02 +02:00
|
|
|
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && m_bFadingOut == rhs.m_bFadingOut;
|
2022-03-18 22:35:51 +01:00
|
|
|
}
|
|
|
|
|
2022-05-30 14:55:42 +02:00
|
|
|
// methods
|
|
|
|
wlr_box getFullWindowBoundingBox();
|
2022-06-23 20:39:48 +02:00
|
|
|
wlr_box getWindowIdealBoundingBoxIgnoreReserved();
|
2022-06-27 00:25:37 +02:00
|
|
|
void updateWindowDecos();
|
2022-06-27 13:42:20 +02:00
|
|
|
pid_t getPID();
|
2022-05-30 14:55:42 +02:00
|
|
|
|
2022-06-24 22:28:54 +02:00
|
|
|
};
|