Wayland cOMPositor written in C++ using Louvre.
1/* ========================================================================
2 *
3 * Filename: WTopBarItem.hpp
4 * Description: W Compositor WTopBarItem 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#include "WTopBarItem.hpp"
11#include "WSurface.hpp"
12#include "WTopBar.hpp"
13#include "prelude.hpp"
14
15WTopBarItem::WTopBarItem(Handle<WTopBar> topBar,
16 Handle<WSurface> surface) noexcept
17 : LTextureView(surface->thumbnail, &topBar->view), topBar(topBar),
18 surface(surface)
19{
20 surface->topBarItems.push_back(this);
21 surfaceLink = std::prev(surface->topBarItems.end());
22
23 setBufferScale(2);
24 enableParentOpacity(false);
25 topBar->update();
26
27 enableInput(true);
28}
29
30WTopBarItem::~WTopBarItem()
31{
32 surface->topBarItems.erase(surfaceLink);
33 setParent(nullptr);
34 topBar->update();
35}
36
37void WTopBarItem::pointerButtonEvent(LPointer::Button button,
38 LPointer::ButtonState state) noexcept
39{
40 if (button == LPointer::Button::Left and
41 state == LPointer::ButtonState::Released)
42 surface->setMinimized(false);
43}