Draw tags

This commit is contained in:
Raphael Robatsch 2021-10-22 15:34:19 +02:00
commit 4c0b1f31fe
7 changed files with 58 additions and 47 deletions

View file

@ -3,22 +3,33 @@
#pragma once
#include <optional>
#include <vector>
#include <wayland-client.h>
#include <QString>
#include <QFontMetrics>
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "common.hpp"
#include "shm_buffer.hpp"
#include "bar_widget.hpp"
struct Tag {
QString name;
bool active;
};
class Bar {
static const zwlr_layer_surface_v1_listener _layerSurfaceListener;
wl_surface *_surface {nullptr};
zwlr_layer_surface_v1 *_layerSurface {nullptr};
std::optional<QFontMetrics> _fontMetrics;
std::optional<ShmBuffer> _bufs;
BarWidget _widget;
std::vector<Tag> _tags;
int _textY;
void layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height);
void render();
void renderTags(QPainter &painter);
int textWidth(const QString &text);
public:
explicit Bar(const wl_output *output);
~Bar();