aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/layout/IHyprLayout.hpp
blob: 71f30e3ddf96e43bb1ccbd5597f21059784f9214 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#pragma once

#include "../defines.hpp"
#include "../Window.hpp"

struct SWindowRenderLayoutHints {
    bool        isBorderColor = false;
    CColor      borderColor;
};

struct SLayoutMessageHeader {
    CWindow*    pWindow = nullptr;
};

interface IHyprLayout {
public:

    /*
        Called when a window is created (mapped)
        The layout HAS TO set the goal pos and size (anim mgr will use it)
        If !animationinprogress, then the anim mgr will not apply an anim.
    */
    virtual void        onWindowCreated(CWindow*)           = 0;
    /*
        Called when a window is removed (unmapped)
    */
    virtual void        onWindowRemoved(CWindow*)           = 0;
    /*
        Called when the monitor requires a layout recalculation
        this usually means reserved area changes
    */
    virtual void        recalculateMonitor(const int&)      = 0;

    /*
        Called when the compositor requests a window
        to be recalculated, e.g. when pseudo is toggled.
    */
    virtual void        recalculateWindow(CWindow*)         = 0;

    /*
        Called when a window is requested to be floated
    */
    virtual void        changeWindowFloatingMode(CWindow*)  = 0;
    /*
        Called when a window is clicked on, beginning a drag
        this might be a resize, move, whatever the layout defines it
        as.
    */
    virtual void        onBeginDragWindow()                 = 0;
    /*
        Called when a window is ended being dragged
        (mouse up)
    */
    virtual void        onEndDragWindow()                   = 0;
    /*
        Called whenever the mouse moves, should the layout want to 
        do anything with it.
        Useful for dragging.
    */
    virtual void        onMouseMove(const Vector2D&)        = 0;
    /*
        Called when a window is created, but is requesting to be floated.
        Warning: this also includes stuff like popups, incorrect handling
        of which can result in a crash!
    */
    virtual void        onWindowCreatedFloating(CWindow*)   = 0;

    /*
        Called when a window requests to toggle its' fullscreen state.
        The layout sets all the fullscreen flags.
        It can either accept or ignore.
    */
    virtual void        fullscreenRequestForWindow(CWindow*)    = 0;

    /*
        Called when a dispatcher requests a custom message
        The layout is free to ignore.
    */
    virtual void         layoutMessage(SLayoutMessageHeader, std::string)  = 0;

    /* 
        Required to be handled, but may return just SWindowRenderLayoutHints()
        Called when the renderer requests any special draw flags for
        a specific window, e.g. border color for groups.
    */
    virtual SWindowRenderLayoutHints requestRenderHints(CWindow*) = 0;

    /* 
        Called when the user requests two windows to be swapped places.
        The layout is free to ignore.
    */
    virtual void         switchWindows(CWindow*, CWindow*)      = 0;

    /*
        Called when the user requests to change the splitratio by X
        on a window
    */
    virtual void         alterSplitRatioBy(CWindow*, float)     = 0;
};