event.hh (3018B)
1 #ifndef __WINSYS_EVENT_H_GUARD__ 2 #define __WINSYS_EVENT_H_GUARD__ 3 4 #include "common.hh" 5 #include "geometry.hh" 6 #include "input.hh" 7 #include "window.hh" 8 9 #include <cstdlib> 10 #include <optional> 11 #include <variant> 12 13 namespace winsys 14 { 15 16 enum class StackMode 17 { 18 Above_, 19 Below_ 20 }; 21 22 enum class PropertyKind 23 { 24 Name, 25 Class, 26 Size, 27 Strut 28 }; 29 30 struct MouseEvent final 31 { 32 MouseCapture capture; 33 bool on_root; 34 }; 35 36 struct KeyEvent final 37 { 38 KeyCapture capture; 39 }; 40 41 struct MapRequestEvent final 42 { 43 Window window; 44 bool ignore; 45 }; 46 47 struct MapEvent final 48 { 49 Window window; 50 bool ignore; 51 }; 52 53 struct EnterEvent final 54 { 55 Window window; 56 }; 57 58 struct LeaveEvent final 59 { 60 Window window; 61 Pos root_rpos; 62 Pos window_rpos; 63 }; 64 65 struct DestroyEvent final 66 { 67 Window window; 68 }; 69 70 struct ExposeEvent final 71 { 72 Window window; 73 }; 74 75 struct UnmapEvent final 76 { 77 Window window; 78 bool ignore; 79 }; 80 81 struct StateRequestEvent final 82 { 83 Window window; 84 WindowState state; 85 Toggle action; 86 bool on_root; 87 }; 88 89 struct FocusRequestEvent final 90 { 91 Window window; 92 bool on_root; 93 }; 94 95 struct CloseRequestEvent final 96 { 97 Window window; 98 bool on_root; 99 }; 100 101 struct WorkspaceRequestEvent final 102 { 103 std::optional<Window> window; 104 std::size_t index; 105 bool on_root; 106 }; 107 108 struct PlacementRequestEvent final 109 { 110 Window window; 111 std::optional<Pos> pos; 112 std::optional<Dim> dim; 113 bool on_root; 114 }; 115 116 struct GripRequestEvent final 117 { 118 Window window; 119 Pos pos; 120 std::optional<Grip> grip; 121 bool on_root; 122 }; 123 124 struct RestackRequestEvent final 125 { 126 Window window; 127 Window sibling; 128 StackMode mode; 129 bool on_root; 130 }; 131 132 struct ConfigureEvent final 133 { 134 Window window; 135 Region region; 136 bool on_root; 137 }; 138 139 struct PropertyEvent final 140 { 141 Window window; 142 PropertyKind kind; 143 bool on_root; 144 }; 145 146 struct FrameExtentsRequestEvent final 147 { 148 Window window; 149 bool on_root; 150 }; 151 152 struct ScreenChangeEvent final {}; 153 154 typedef std::variant< 155 std::monostate, 156 MouseEvent, 157 KeyEvent, 158 MapRequestEvent, 159 MapEvent, 160 EnterEvent, 161 LeaveEvent, 162 DestroyEvent, 163 ExposeEvent, 164 UnmapEvent, 165 StateRequestEvent, 166 FocusRequestEvent, 167 CloseRequestEvent, 168 WorkspaceRequestEvent, 169 PlacementRequestEvent, 170 GripRequestEvent, 171 RestackRequestEvent, 172 ConfigureEvent, 173 PropertyEvent, 174 FrameExtentsRequestEvent, 175 ScreenChangeEvent 176 > Event; 177 178 } 179 180 #endif//__WINSYS_EVENT_H_GUARD__