Wayland cOMPositor written in C++ using Louvre.
1/* ========================================================================
2 *
3 * Filename: global.hpp
4 * Description: W Compositor global helper class declaration
5 * GitHub Repo: https://github.com/diego-est/womp
6 * Author: Diego A. Estrada Rivera
7 * License: GPL-3.0
8 *
9 * ======================================================================== */
10#pragma once
11#include "prelude.hpp"
12#include <LCompositor.h>
13
14#define TOPBAR_HEIGHT 32
15#define TOPBAR_PADDING 4
16#define THUMBNAIL_MARGIN 4
17#define THUMBNAIL_HEIGHT (TOPBAR_HEIGHT - 2 * TOPBAR_PADDING)
18
19using namespace Louvre;
20
21class WCompositor;
22class WOutput;
23class WSurface;
24
25class G {
26 public:
27 fn static inline compositor() noexcept -> Handle<WCompositor>
28 {
29 return Handle<WCompositor>(LCompositor::compositor());
30 }
31
32 fn static inline outputs() noexcept -> Ref<std::list<Handle<WOutput>>>
33 {
34 return Ref<std::list<Handle<WOutput>>>(
35 LCompositor::compositor()->outputs());
36 }
37
38 fn static scene() noexcept -> Handle<LScene>;
39
40 // cast the LCompositor::surfaces() from LSurface to WSurface
41 fn static inline surfaces() noexcept -> Ref<std::list<Handle<WSurface>>>
42 {
43 return Ref<std::list<Handle<WSurface>>>(
44 LCompositor::compositor()->surfaces());
45 }
46 // avoid bool in moveSurfaceWithChildren
47 enum class SubSurfacesOnly { off, on };
48
49 // move surface views with children
50 static void moveSurfaceWithChildren(
51 Handle<WSurface> surface, Handle<LView> parent,
52 SubSurfacesOnly opt = SubSurfacesOnly::off) noexcept;
53};