2022-03-17 20:22:29 +01:00
# pragma once
2022-05-28 20:46:20 +02:00
# include <deque>
2024-05-28 23:37:24 +02:00
# include <string>
2024-03-20 02:44:51 +01:00
# include "../config/ConfigDataValues.hpp"
2024-05-28 23:37:24 +02:00
# include "../defines.hpp"
# include "../helpers/AnimatedVariable.hpp"
2024-03-20 02:44:51 +01:00
# include "../helpers/Vector2D.hpp"
2024-05-28 23:37:24 +02:00
# include "../helpers/signal/Signal.hpp"
# include "../helpers/TagKeeper.hpp"
2024-03-20 02:44:51 +01:00
# include "../macros.hpp"
# include "../managers/XWaylandManager.hpp"
2024-05-28 23:37:24 +02:00
# include "../render/decorations/IHyprWindowDecoration.hpp"
2024-04-02 21:32:39 +02:00
# include "DesktopTypes.hpp"
2024-05-28 23:37:24 +02:00
# include "Popup.hpp"
# include "Subsurface.hpp"
# include "WLSurface.hpp"
2022-03-17 20:22:29 +01:00
2024-05-11 00:28:33 +02:00
class CXDGSurfaceResource ;
2024-05-25 22:43:51 +02:00
class CXWaylandSurface ;
2024-05-11 00:28:33 +02:00
2023-12-06 23:54:56 +01:00
enum eIdleInhibitMode {
2022-10-31 13:26:07 +01:00
IDLEINHIBIT_NONE = 0 ,
IDLEINHIBIT_ALWAYS ,
IDLEINHIBIT_FULLSCREEN ,
IDLEINHIBIT_FOCUS
} ;
2023-12-06 23:54:56 +01:00
enum eGroupRules {
2023-09-22 01:42:00 +02:00
// effective only during first map, except for _ALWAYS variant
GROUP_NONE = 0 ,
GROUP_SET = 1 < < 0 , // Open as new group or add to focused group
GROUP_SET_ALWAYS = 1 < < 1 ,
GROUP_BARRED = 1 < < 2 , // Don't insert to focused group.
GROUP_LOCK = 1 < < 3 , // Lock m_sGroupData.lock
GROUP_LOCK_ALWAYS = 1 < < 4 ,
GROUP_INVADE = 1 < < 5 , // Force enter a group, event if lock is engaged
GROUP_OVERRIDE = 1 < < 6 , // Override other rules
} ;
2024-02-04 16:40:20 +01:00
enum eGetWindowProperties {
WINDOW_ONLY = 0 ,
RESERVED_EXTENTS = 1 < < 0 ,
INPUT_EXTENTS = 1 < < 1 ,
FULL_EXTENTS = 1 < < 2 ,
FLOATING_ONLY = 1 < < 3 ,
ALLOW_FLOATING = 1 < < 4 ,
2024-02-14 23:19:49 +01:00
USE_PROP_TILED = 1 < < 5 ,
} ;
enum eSuppressEvents {
SUPPRESS_NONE = 0 ,
SUPPRESS_FULLSCREEN = 1 < < 0 ,
SUPPRESS_MAXIMIZE = 1 < < 1 ,
SUPPRESS_ACTIVATE = 1 < < 2 ,
SUPPRESS_ACTIVATE_FOCUSONLY = 1 < < 3 ,
2024-02-04 16:40:20 +01:00
} ;
2023-10-21 15:15:48 +02:00
class IWindowTransformer ;
2023-01-24 20:05:34 +01:00
template < typename T >
class CWindowOverridableVar {
public :
2024-06-17 17:37:36 +02:00
CWindowOverridableVar ( T const & val ) {
2023-01-24 20:05:34 +01:00
value = val ;
}
2023-01-24 23:46:16 +01:00
~ CWindowOverridableVar ( ) = default ;
2024-06-17 17:37:36 +02:00
CWindowOverridableVar < T > & operator = ( CWindowOverridableVar < T > const & other ) {
// Self-assignment check
if ( this = = & other )
2023-01-24 20:05:34 +01:00
return * this ;
2024-06-17 17:37:36 +02:00
// Check if the current object is locked
if ( ! locked ) {
locked = other . locked ;
value = other . value ;
}
2023-01-24 20:05:34 +01:00
return * this ;
}
T operator = ( T & other ) {
if ( locked )
return value ;
value = other ;
return other ;
}
2024-06-17 17:37:36 +02:00
void forceSetIgnoreLocked ( T const & val , bool lock = false ) {
2023-01-24 20:05:34 +01:00
value = val ;
locked = lock ;
}
2024-06-17 17:37:36 +02:00
T operator * ( T const & other ) {
2023-01-24 20:05:34 +01:00
return value * other ;
}
2024-06-17 17:37:36 +02:00
T operator + ( T const & other ) {
2023-01-24 20:05:34 +01:00
return value + other ;
}
2024-06-17 17:37:36 +02:00
bool operator = = ( T const & other ) {
2023-01-24 20:05:34 +01:00
return other = = value ;
}
2024-06-17 17:37:36 +02:00
bool operator > = ( T const & other ) {
2023-01-24 20:05:34 +01:00
return value > = other ;
}
2024-06-17 17:37:36 +02:00
bool operator < = ( T const & other ) {
2023-01-24 20:05:34 +01:00
return value < = other ;
}
2024-06-17 17:37:36 +02:00
bool operator > ( T const & other ) {
2023-01-24 20:05:34 +01:00
return value > other ;
}
2024-06-17 17:37:36 +02:00
bool operator < ( T const & other ) {
2023-01-24 20:05:34 +01:00
return value < other ;
}
explicit operator bool ( ) {
return static_cast < bool > ( value ) ;
}
T toUnderlying ( ) {
return value ;
}
bool locked = false ;
private :
T value ;
} ;
2022-04-22 14:37:38 +02:00
struct SWindowSpecialRenderData {
2024-04-08 00:19:02 +02:00
CWindowOverridableVar < bool > alphaOverride = false ;
CWindowOverridableVar < float > alpha = 1.f ;
CWindowOverridableVar < bool > alphaInactiveOverride = false ;
CWindowOverridableVar < float > alphaInactive = - 1.f ; // -1 means unset
CWindowOverridableVar < bool > alphaFullscreenOverride = false ;
CWindowOverridableVar < float > alphaFullscreen = - 1.f ; // -1 means unset
2022-08-01 12:51:52 +02:00
2024-01-14 18:27:32 +01:00
CWindowOverridableVar < CGradientValueData > activeBorderColor = CGradientValueData ( ) ; // empty color vector means unset
CWindowOverridableVar < CGradientValueData > inactiveBorderColor = CGradientValueData ( ) ; // empty color vector means unset
2022-11-13 20:33:13 +01:00
2022-08-01 12:51:52 +02:00
// set by the layout
2023-06-04 21:29:38 +02:00
CWindowOverridableVar < int > borderSize = - 1 ; // -1 means unset
bool rounding = true ;
bool border = true ;
bool decorate = true ;
2023-08-12 23:37:55 +02:00
bool shadow = true ;
2022-09-25 20:07:48 +02:00
} ;
2022-03-17 20:22:29 +01:00
2022-05-15 14:18:31 +02:00
struct SWindowAdditionalConfigData {
2024-03-08 03:24:44 +01:00
std : : string animationStyle = std : : string ( " " ) ;
CWindowOverridableVar < int > rounding = - 1 ; // -1 means no
CWindowOverridableVar < bool > forceNoBlur = false ;
CWindowOverridableVar < bool > forceOpaque = false ;
CWindowOverridableVar < bool > forceOpaqueOverridden = false ; // if true, a rule will not change the forceOpaque state. This is for the force opaque dispatcher.
CWindowOverridableVar < bool > forceAllowsInput = false ;
CWindowOverridableVar < bool > forceNoAnims = false ;
CWindowOverridableVar < bool > forceNoBorder = false ;
CWindowOverridableVar < bool > forceNoShadow = false ;
CWindowOverridableVar < bool > forceNoDim = false ;
CWindowOverridableVar < bool > noFocus = false ;
CWindowOverridableVar < bool > windowDanceCompat = false ;
CWindowOverridableVar < bool > noMaxSize = false ;
CWindowOverridableVar < Vector2D > maxSize = Vector2D ( std : : numeric_limits < double > : : max ( ) , std : : numeric_limits < double > : : max ( ) ) ;
2024-03-08 18:10:38 +01:00
CWindowOverridableVar < Vector2D > minSize = Vector2D ( 20 , 20 ) ;
2024-03-08 03:24:44 +01:00
CWindowOverridableVar < bool > dimAround = false ;
CWindowOverridableVar < bool > forceRGBX = false ;
CWindowOverridableVar < bool > keepAspectRatio = false ;
2024-05-10 13:27:54 +02:00
CWindowOverridableVar < bool > focusOnActivate = false ;
2024-03-08 03:24:44 +01:00
CWindowOverridableVar < int > xray = - 1 ; // -1 means unset, takes precedence over the renderdata one
CWindowOverridableVar < int > borderSize = - 1 ; // -1 means unset, takes precedence over the renderdata one
CWindowOverridableVar < bool > forceTearing = false ;
CWindowOverridableVar < bool > nearestNeighbor = false ;
2022-05-15 14:18:31 +02:00
} ;
2022-11-15 11:21:26 +01:00
struct SWindowRule {
std : : string szRule ;
std : : string szValue ;
2022-12-16 18:17:31 +01:00
bool v2 = false ;
2022-11-15 11:21:26 +01:00
std : : string szTitle ;
std : : string szClass ;
2023-12-26 23:47:46 +01:00
std : : string szInitialTitle ;
std : : string szInitialClass ;
2024-05-28 23:37:24 +02:00
std : : string szTag ;
2024-03-19 21:56:20 +01:00
int bX11 = - 1 ; // -1 means "ANY"
int bFloating = - 1 ;
int bFullscreen = - 1 ;
int bPinned = - 1 ;
int bFocus = - 1 ;
std : : string szOnWorkspace = " " ; // empty means any
std : : string szWorkspace = " " ; // empty means any
2022-11-15 11:21:26 +01:00
} ;
2024-04-24 17:16:46 +02:00
struct SInitialWorkspaceToken {
2024-04-27 13:43:12 +02:00
PHLWINDOWREF primaryOwner ;
std : : string workspace ;
2024-04-24 17:16:46 +02:00
} ;
2022-03-17 20:22:29 +01:00
class CWindow {
2022-12-16 18:17:31 +01:00
public :
2024-05-11 00:28:33 +02:00
static PHLWINDOW create ( SP < CXDGSurfaceResource > ) ;
2024-05-25 22:43:51 +02:00
static PHLWINDOW create ( SP < CXWaylandSurface > ) ;
2024-04-27 13:43:12 +02:00
private :
2024-05-11 00:28:33 +02:00
CWindow ( SP < CXDGSurfaceResource > resource ) ;
2024-05-25 22:43:51 +02:00
CWindow ( SP < CXWaylandSurface > surface ) ;
2024-04-27 13:43:12 +02:00
public :
2022-03-30 21:18:42 +02:00
~ CWindow ( ) ;
2024-06-08 10:07:59 +02:00
SP < CWLSurface > m_pWLSurface ;
2023-03-20 16:00:58 +01:00
2024-04-21 17:28:50 +02:00
struct {
CSignal destroy ;
} events ;
2024-05-11 00:28:33 +02:00
WP < CXDGSurfaceResource > m_pXDGSurface ;
2024-05-25 22:43:51 +02:00
WP < CXWaylandSurface > m_pXWaylandSurface ;
2022-03-17 20:22:29 +01:00
// this is the position and size of the "bounding box"
2022-12-20 03:18:47 +01:00
Vector2D m_vPosition = Vector2D ( 0 , 0 ) ;
Vector2D m_vSize = Vector2D ( 0 , 0 ) ;
2022-03-17 20:22:29 +01:00
// this is the real position and size used to draw the thing
2024-03-02 01:35:17 +01:00
CAnimatedVariable < Vector2D > m_vRealPosition ;
CAnimatedVariable < Vector2D > m_vRealSize ;
2022-03-17 20:22:29 +01:00
2022-07-28 23:55:00 +02:00
// for not spamming the protocols
2023-11-10 01:13:22 +01:00
Vector2D m_vReportedPosition ;
Vector2D m_vReportedSize ;
Vector2D m_vPendingReportedSize ;
std : : optional < std : : pair < uint32_t , Vector2D > > m_pPendingSizeAck ;
std : : vector < std : : pair < uint32_t , Vector2D > > m_vPendingSizeAcks ;
2022-07-28 23:55:00 +02:00
2022-08-05 17:52:14 +02:00
// for restoring floating statuses
2022-12-20 03:18:47 +01:00
Vector2D m_vLastFloatingSize ;
Vector2D m_vLastFloatingPosition ;
2022-08-05 17:52:14 +02:00
2024-03-31 03:14:26 +02:00
// for floating window offset in workspace animations
Vector2D m_vFloatingOffset = Vector2D ( 0 , 0 ) ;
2022-04-02 20:04:32 +02:00
// this is used for pseudotiling
2024-06-07 19:52:15 +02:00
bool m_bIsPseudotiled = false ;
Vector2D m_vPseudoSize = Vector2D ( 1280 , 720 ) ;
// for recovering relative cursor position
Vector2D m_vRelativeCursorCoordsOnLastWarp = Vector2D ( - 1 , - 1 ) ;
2022-04-02 20:04:32 +02:00
2024-04-02 21:32:39 +02:00
bool m_bFirstMap = false ; // for layouts
bool m_bIsFloating = false ;
bool m_bDraggingTiled = false ; // for dragging around tiled windows
bool m_bIsFullscreen = false ;
bool m_bDontSendFullscreen = false ;
bool m_bWasMaximized = false ;
uint64_t m_iMonitorID = - 1 ;
std : : string m_szTitle = " " ;
2024-05-11 00:28:33 +02:00
std : : string m_szClass = " " ;
2024-04-02 21:32:39 +02:00
std : : string m_szInitialTitle = " " ;
std : : string m_szInitialClass = " " ;
PHLWORKSPACE m_pWorkspace ;
2022-03-18 20:03:39 +01:00
2024-04-02 21:32:39 +02:00
bool m_bIsMapped = false ;
2022-03-22 20:53:11 +01:00
2024-04-02 21:32:39 +02:00
bool m_bRequestsFloat = false ;
2022-05-26 19:05:32 +02:00
2022-03-30 20:16:23 +02:00
// This is for fullscreen apps
2022-12-20 03:18:47 +01:00
bool m_bCreatedOverFullscreen = false ;
2022-03-30 20:16:23 +02:00
2022-03-18 20:03:39 +01:00
// XWayland stuff
2024-04-27 13:43:12 +02:00
bool m_bIsX11 = false ;
PHLWINDOWREF m_pX11Parent ;
uint64_t m_iX11Type = 0 ;
bool m_bIsModal = false ;
bool m_bX11DoesntWantBorders = false ;
bool m_bX11ShouldntFocus = false ;
float m_fX11SurfaceScaledBy = 1.f ;
2022-03-18 20:03:39 +01:00
//
2022-03-18 22:35:51 +01:00
2022-05-14 14:37:57 +02:00
// For nofocus
2022-12-20 03:18:47 +01:00
bool m_bNoInitialFocus = false ;
2022-05-14 14:37:57 +02:00
2023-07-23 19:47:41 +02:00
// Fullscreen and Maximize
2024-02-14 23:19:49 +01:00
bool m_bWantsInitialFullscreen = false ;
// bitfield eSuppressEvents
2024-02-29 01:03:28 +01:00
uint64_t m_eSuppressedEvents = SUPPRESS_NONE ;
2022-08-21 22:30:48 +02:00
2024-02-29 15:26:02 +01:00
// desktop components
2024-02-29 01:03:28 +01:00
std : : unique_ptr < CSubsurface > m_pSubsurfaceHead ;
2024-02-29 15:26:02 +01:00
std : : unique_ptr < CPopup > m_pPopupHead ;
2022-03-27 21:46:27 +02:00
2022-03-31 17:50:00 +02:00
// Animated border
2024-03-02 01:35:17 +01:00
CGradientValueData m_cRealBorderColor = { 0 } ;
CGradientValueData m_cRealBorderColorPrevious = { 0 } ;
CAnimatedVariable < float > m_fBorderFadeAnimationProgress ;
CAnimatedVariable < float > m_fBorderAngleAnimationProgress ;
2022-03-31 17:50:00 +02:00
2022-04-05 19:28:10 +02:00
// Fade in-out
2024-03-02 01:35:17 +01:00
CAnimatedVariable < float > m_fAlpha ;
2023-08-09 14:28:04 +02:00
bool m_bFadingOut = false ;
bool m_bReadyToDelete = false ;
Vector2D m_vOriginalClosedPos ; // these will be used for calculations later on in
Vector2D m_vOriginalClosedSize ; // drawing the closing animations
SWindowDecorationExtents m_eOriginalClosedExtents ;
2024-03-17 02:05:26 +01:00
bool m_bAnimatingIn = false ;
2022-04-05 19:28:10 +02:00
2022-09-10 13:11:02 +02:00
// For pinned (sticky) windows
2022-12-20 03:18:47 +01:00
bool m_bPinned = false ;
2022-09-10 13:11:02 +02:00
2023-01-14 20:31:11 +01:00
// urgency hint
bool m_bIsUrgent = false ;
2023-01-01 16:54:13 +01:00
// fakefullscreen
2023-01-06 13:29:43 +01:00
bool m_bFakeFullscreenState = false ;
2023-01-01 16:54:13 +01:00
2022-08-24 22:01:25 +02:00
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
2024-04-27 13:43:12 +02:00
PHLWINDOWREF m_pLastCycledWindow ;
2022-08-24 22:01:25 +02:00
2022-05-28 20:46:20 +02:00
// Window decorations
2024-05-07 17:50:30 +02:00
// TODO: make this a SP.
2022-05-28 23:43:11 +02:00
std : : deque < std : : unique_ptr < IHyprWindowDecoration > > m_dWindowDecorations ;
2022-12-16 18:17:31 +01: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
2022-12-20 03:18:47 +01:00
SWindowSpecialRenderData m_sSpecialRenderData ;
SWindowAdditionalConfigData m_sAdditionalConfigData ;
2022-03-18 22:35:51 +01:00
2023-10-21 15:15:48 +02:00
// Transformers
std : : vector < std : : unique_ptr < IWindowTransformer > > m_vTransformers ;
2022-07-12 13:40:55 +02:00
// for alpha
2024-03-02 01:35:17 +01:00
CAnimatedVariable < float > m_fActiveInactiveAlpha ;
2022-07-12 13:40:55 +02:00
2022-07-16 12:44:45 +02:00
// animated shadow color
2024-03-02 01:35:17 +01:00
CAnimatedVariable < CColor > m_cRealShadowColor ;
2022-07-16 12:44:45 +02:00
2022-08-30 12:46:17 +02:00
// animated tint
2024-03-02 01:35:17 +01:00
CAnimatedVariable < float > m_fDimPercent ;
2022-08-30 12:46:17 +02:00
2022-10-01 20:19:15 +02:00
// swallowing
2024-04-27 13:43:12 +02:00
PHLWINDOWREF m_pSwallowed ;
2022-10-01 20:19:15 +02:00
2023-07-04 12:05:25 +02:00
// focus stuff
bool m_bStayFocused = false ;
2022-08-06 20:57:38 +02:00
// for toplevel monitor events
2022-12-20 03:18:47 +01:00
uint64_t m_iLastToplevelMonitorID = - 1 ;
uint64_t m_iLastSurfaceMonitorID = - 1 ;
2022-08-06 20:57:38 +02:00
2022-10-31 13:26:07 +01:00
// for idle inhibiting windows
2022-12-20 03:18:47 +01:00
eIdleInhibitMode m_eIdleInhibitMode = IDLEINHIBIT_NONE ;
2022-10-31 13:26:07 +01:00
2024-04-23 02:28:20 +02:00
// initial token. Will be unregistered on workspace change or timeout of 2 minutes
std : : string m_szInitialWorkspaceToken = " " ;
2023-02-19 22:07:32 +01:00
// for groups
struct SGroupData {
2024-04-27 13:43:12 +02:00
PHLWINDOWREF pNextWindow ; // nullptr means no grouping. Self means single group.
bool head = false ;
bool locked = false ; // per group lock
bool deny = false ; // deny window from enter a group or made a group
2023-02-19 22:07:32 +01:00
} m_sGroupData ;
2023-09-22 01:42:00 +02:00
uint16_t m_eGroupRules = GROUP_NONE ;
2023-02-19 22:07:32 +01:00
2023-09-28 22:48:33 +02:00
bool m_bTearingHint = false ;
2024-05-02 03:17:55 +02:00
// stores the currently matched window rules
std : : vector < SWindowRule > m_vMatchedRules ;
2024-05-28 23:37:24 +02:00
// window tags
CTagKeeper m_tags ;
2022-03-18 22:35:51 +01:00
// For the list lookup
2022-12-20 03:18:47 +01:00
bool operator = = ( const CWindow & rhs ) {
2024-05-25 22:43:51 +02:00
return m_pXDGSurface = = rhs . m_pXDGSurface & & m_pXWaylandSurface = = rhs . m_pXWaylandSurface & & m_vPosition = = rhs . m_vPosition & & m_vSize = = rhs . m_vSize & &
2022-12-16 18:17:31 +01:00
m_bFadingOut = = rhs . m_bFadingOut ;
2022-03-18 22:35:51 +01:00
}
2022-05-30 14:55:42 +02:00
// methods
2023-11-04 18:03:05 +01:00
CBox getFullWindowBoundingBox ( ) ;
2023-08-09 14:28:04 +02:00
SWindowDecorationExtents getFullWindowExtents ( ) ;
2024-02-04 16:40:20 +01:00
CBox getWindowBoxUnified ( uint64_t props ) ;
2023-11-04 18:03:05 +01:00
CBox getWindowMainSurfaceBox ( ) ;
CBox getWindowIdealBoundingBoxIgnoreReserved ( ) ;
2023-11-11 15:37:17 +01:00
void addWindowDeco ( std : : unique_ptr < IHyprWindowDecoration > deco ) ;
2023-02-28 20:36:36 +01:00
void updateWindowDecos ( ) ;
2023-11-11 15:37:17 +01:00
void removeWindowDeco ( IHyprWindowDecoration * deco ) ;
2023-12-30 15:18:53 +01:00
void uncacheWindowDecos ( ) ;
2023-12-28 23:54:41 +01:00
bool checkInputOnDecos ( const eInputType , const Vector2D & , std : : any = { } ) ;
2023-02-28 20:36:36 +01:00
pid_t getPID ( ) ;
IHyprWindowDecoration * getDecorationByType ( eDecorationType ) ;
void removeDecorationByType ( eDecorationType ) ;
void updateToplevel ( ) ;
2024-06-08 10:07:59 +02:00
void updateSurfaceScaleTransformDetails ( bool force = false ) ;
2024-04-02 21:32:39 +02:00
void moveToWorkspace ( PHLWORKSPACE ) ;
2024-04-27 13:43:12 +02:00
PHLWINDOW X11TransientFor ( ) ;
2023-02-28 20:36:36 +01:00
void onUnmap ( ) ;
void onMap ( ) ;
void setHidden ( bool hidden ) ;
bool isHidden ( ) ;
void applyDynamicRule ( const SWindowRule & r ) ;
void updateDynamicRules ( ) ;
SWindowDecorationExtents getFullWindowReservedArea ( ) ;
2023-04-14 16:03:53 +02:00
Vector2D middle ( ) ;
2023-04-22 13:36:50 +02:00
bool opaque ( ) ;
2023-07-19 16:13:55 +02:00
float rounding ( ) ;
2023-09-28 22:48:33 +02:00
bool canBeTorn ( ) ;
2023-12-11 17:51:10 +01:00
bool shouldSendFullscreenState ( ) ;
2023-12-23 22:30:49 +01:00
void setSuspended ( bool suspend ) ;
2024-03-14 19:25:28 +01:00
bool visibleOnMonitor ( CMonitor * pMonitor ) ;
2024-04-02 21:32:39 +02:00
int workspaceID ( ) ;
bool onSpecialWorkspace ( ) ;
2024-05-08 02:31:16 +02:00
void activate ( bool force = false ) ;
2024-05-11 00:28:33 +02:00
int surfacesCount ( ) ;
2023-02-28 20:36:36 +01:00
2023-08-17 10:13:19 +02:00
int getRealBorderSize ( ) ;
void updateSpecialRenderData ( ) ;
2024-04-10 18:26:11 +02:00
void updateSpecialRenderData ( const struct SWorkspaceRule & ) ;
2023-08-17 10:13:19 +02:00
2023-02-28 20:36:36 +01:00
void onBorderAngleAnimEnd ( void * ptr ) ;
bool isInCurvedCorner ( double x , double y ) ;
bool hasPopupAt ( const Vector2D & pos ) ;
2024-03-25 17:08:55 +01:00
int popupsCount ( ) ;
2023-02-28 20:36:36 +01:00
2023-09-22 01:42:00 +02:00
void applyGroupRules ( ) ;
void createGroup ( ) ;
void destroyGroup ( ) ;
2024-04-27 13:43:12 +02:00
PHLWINDOW getGroupHead ( ) ;
PHLWINDOW getGroupTail ( ) ;
PHLWINDOW getGroupCurrent ( ) ;
PHLWINDOW getGroupPrevious ( ) ;
PHLWINDOW getGroupWindowByIndex ( int ) ;
2023-08-30 17:39:22 +02:00
int getGroupSize ( ) ;
2024-04-27 13:43:12 +02:00
bool canBeGroupedInto ( PHLWINDOW pWindow ) ;
void setGroupCurrent ( PHLWINDOW pWindow ) ;
void insertWindowToGroup ( PHLWINDOW pWindow ) ;
2023-03-18 17:30:29 +01:00
void updateGroupOutputs ( ) ;
2024-04-27 13:43:12 +02:00
void switchWithWindowInGroup ( PHLWINDOW pWindow ) ;
2024-03-19 03:52:52 +01:00
void setAnimationsToMove ( ) ;
2024-03-31 03:14:26 +02:00
void onWorkspaceAnimUpdate ( ) ;
2024-05-11 00:28:33 +02:00
void onUpdateState ( ) ;
void onUpdateMeta ( ) ;
2024-05-25 22:43:51 +02:00
void onX11Configure ( CBox box ) ;
void onResourceChangeX11 ( ) ;
2024-05-11 00:28:33 +02:00
std : : string fetchTitle ( ) ;
std : : string fetchClass ( ) ;
2024-06-07 19:52:15 +02:00
void warpCursor ( ) ;
2024-06-15 18:20:09 +02:00
PHLWINDOW getSwallower ( ) ;
2024-05-11 00:28:33 +02:00
// listeners
void onAck ( uint32_t serial ) ;
2023-02-19 22:07:32 +01:00
2024-04-23 02:28:20 +02:00
//
std : : unordered_map < std : : string , std : : string > getEnv ( ) ;
2024-04-27 13:43:12 +02:00
//
PHLWINDOWREF m_pSelf ;
2024-05-11 00:28:33 +02:00
// make private once we move listeners to inside CWindow
struct {
CHyprSignalListener map ;
CHyprSignalListener ack ;
CHyprSignalListener unmap ;
CHyprSignalListener commit ;
CHyprSignalListener destroy ;
2024-05-25 22:43:51 +02:00
CHyprSignalListener activate ;
CHyprSignalListener configure ;
CHyprSignalListener setGeometry ;
2024-05-11 00:28:33 +02:00
CHyprSignalListener updateState ;
CHyprSignalListener updateMetadata ;
2024-05-25 22:43:51 +02:00
CHyprSignalListener resourceChange ;
2024-05-11 00:28:33 +02:00
} listeners ;
2022-12-16 18:17:31 +01:00
private :
2022-10-14 21:46:32 +02:00
// For hidden windows and stuff
2024-04-02 21:32:39 +02:00
bool m_bHidden = false ;
bool m_bSuspended = false ;
int m_iLastWorkspace = WORKSPACE_INVALID ;
2022-06-24 22:28:54 +02:00
} ;
2023-09-20 17:25:03 +02:00
2024-04-27 13:43:12 +02:00
inline bool valid ( PHLWINDOW w ) {
return w . get ( ) ;
}
inline bool valid ( PHLWINDOWREF w ) {
2024-05-05 18:16:00 +02:00
return ! w . expired ( ) ;
2024-04-27 13:43:12 +02:00
}
inline bool validMapped ( PHLWINDOW w ) {
if ( ! valid ( w ) )
return false ;
return w - > m_bIsMapped ;
}
inline bool validMapped ( PHLWINDOWREF w ) {
if ( ! valid ( w ) )
return false ;
2024-05-05 18:16:00 +02:00
return w - > m_bIsMapped ;
2024-04-27 13:43:12 +02:00
}
2023-09-20 17:25:03 +02:00
/**
format specification
- ' x ' , only address , equivalent of ( uintpr_t ) CWindow *
- ' m ' , with monitor id
- ' w ' , with workspace id
- ' c ' , with application class
*/
template < typename CharT >
2024-04-27 13:43:12 +02:00
struct std : : formatter < PHLWINDOW , CharT > : std : : formatter < CharT > {
2023-09-20 17:25:03 +02:00
bool formatAddressOnly = false ;
bool formatWorkspace = false ;
bool formatMonitor = false ;
bool formatClass = false ;
FORMAT_PARSE ( //
FORMAT_FLAG ( ' x ' , formatAddressOnly ) //
FORMAT_FLAG ( ' m ' , formatMonitor ) //
FORMAT_FLAG ( ' w ' , formatWorkspace ) //
FORMAT_FLAG ( ' c ' , formatClass ) ,
2024-04-27 13:43:12 +02:00
PHLWINDOW )
2023-09-20 17:25:03 +02:00
template < typename FormatContext >
2024-04-27 13:43:12 +02:00
auto format ( PHLWINDOW const & w , FormatContext & ctx ) const {
2023-09-20 17:25:03 +02:00
auto & & out = ctx . out ( ) ;
if ( formatAddressOnly )
2024-04-27 13:43:12 +02:00
return std : : format_to ( out , " {:x} " , ( uintptr_t ) w . get ( ) ) ;
2023-09-20 17:25:03 +02:00
if ( ! w )
return std : : format_to ( out , " [Window nullptr] " ) ;
std : : format_to ( out , " [ " ) ;
2024-04-27 13:43:12 +02:00
std : : format_to ( out , " Window {:x}: title: \" {} \" " , ( uintptr_t ) w . get ( ) , w - > m_szTitle ) ;
2023-09-20 17:25:03 +02:00
if ( formatWorkspace )
2024-04-02 21:32:39 +02:00
std : : format_to ( out , " , workspace: {} " , w - > m_pWorkspace ? w - > workspaceID ( ) : WORKSPACE_INVALID ) ;
2023-09-20 17:25:03 +02:00
if ( formatMonitor )
std : : format_to ( out , " , monitor: {} " , w - > m_iMonitorID ) ;
if ( formatClass )
2024-05-11 00:28:33 +02:00
std : : format_to ( out , " , class: {} " , w - > m_szClass ) ;
2023-09-20 17:25:03 +02:00
return std : : format_to ( out , " ] " ) ;
}
2023-10-30 15:54:12 +01:00
} ;