Wayland cOMPositor written in C++ using Louvre.
1/* ========================================================================
2 *
3 * Filename: global.cpp
4 * Description: W Compositor global helper class
5 * GitHub Repo: https://github.com/diego-est/womp
6 * Author: Diego A. Estrada Rivera
7 * License: GPL-3.0
8 *
9 * ======================================================================== */
10#include "global.hpp"
11#include "WCompositor.hpp"
12#include "WSurface.hpp"
13#include "prelude.hpp"
14
15fn G::scene() noexcept -> Handle<LScene>
16{
17 return &compositor()->scene;
18}
19
20void G::moveSurfaceWithChildren(Handle<WSurface> surface, Handle<LView> parent,
21 SubSurfacesOnly opt) noexcept
22{
23 surface->view.setParent(parent);
24 var next = surface;
25
26 if (opt == SubSurfacesOnly::on) {
27 while ((next = Handle<WSurface>(next->nextSurface())))
28 if (next->isSubchildOf(surface) and
29 next->subsurface() != nullptr)
30 next->view.setParent(parent);
31 } else {
32 while ((next = Handle<WSurface>(next->nextSurface())))
33 if (next->isSubchildOf(surface))
34 next->view.setParent(parent);
35 }
36}