replace qt with cairo/pango/epoll

This commit is contained in:
Raphael Robatsch 2021-10-27 17:24:47 +02:00
parent 31c09e24d6
commit 3db22e4a71
6 changed files with 206 additions and 125 deletions

View File

@ -3,7 +3,9 @@ project('somebar', ['c', 'cpp'],
wayland_dep = dependency('wayland-client') wayland_dep = dependency('wayland-client')
wayland_cursor_dep = dependency('wayland-cursor') wayland_cursor_dep = dependency('wayland-cursor')
qt5_dep = dependency('qt5', modules: ['Core', 'Gui']) cairo_dep = dependency('cairo')
pango_dep = dependency('pango')
pangocairo_dep = dependency('pangocairo')
subdir('protocols') subdir('protocols')
@ -12,4 +14,10 @@ executable('somebar',
'src/shm_buffer.cpp', 'src/shm_buffer.cpp',
'src/bar.cpp', 'src/bar.cpp',
wayland_sources, wayland_sources,
dependencies: [wayland_dep, wayland_cursor_dep, qt5_dep]) dependencies: [
wayland_dep,
wayland_cursor_dep,
cairo_dep,
pango_dep,
pangocairo_dep,
])

View File

@ -1,11 +1,14 @@
// somebar - dwl bar // somebar - dwl barbar
// See LICENSE file for copyright and license details. // See LICENSE file for copyright and license details.
#include <QColor> #include <wayland-client-protocol.h>
#include <QImage> #include <pango/pangocairo.h>
#include <QPainter>
#include "bar.hpp" #include "bar.hpp"
#include "cairo.h"
#include "config.hpp" #include "config.hpp"
#include "pango/pango-font.h"
#include "pango/pango-fontmap.h"
#include "pango/pango-layout.h"
const zwlr_layer_surface_v1_listener Bar::_layerSurfaceListener = { const zwlr_layer_surface_v1_listener Bar::_layerSurfaceListener = {
[](void *owner, zwlr_layer_surface_v1*, uint32_t serial, uint32_t width, uint32_t height) [](void *owner, zwlr_layer_surface_v1*, uint32_t serial, uint32_t width, uint32_t height)
@ -21,25 +24,60 @@ const wl_callback_listener Bar::_frameListener = {
} }
}; };
static QFont getFont() struct Font {
PangoFontDescription *description;
int height {0};
};
static Font getFont()
{ {
QFont font {fontFamily, fontSizePt}; auto fontMap = pango_cairo_font_map_get_default();
font.setBold(fontBold); auto fontDesc = pango_font_description_from_string(font);
return font; auto tempContext = pango_font_map_create_context(fontMap);
} auto font = pango_font_map_load_font(fontMap, tempContext, fontDesc);
static QFont font = getFont(); auto metrics = pango_font_get_metrics(font, pango_language_get_default());
static QFontMetrics fontMetrics = QFontMetrics {font};
const wl_surface* Bar::surface() const { return _surface.get(); } auto res = Font {};
res.description = fontDesc;
res.height = PANGO_PIXELS(pango_font_metrics_get_height(metrics));
pango_font_metrics_unref(metrics);
g_object_unref(font);
g_object_unref(tempContext);
g_object_unref(fontMap);
return res;
}
static Font barfont = getFont();
BarComponent::BarComponent() { }
BarComponent::BarComponent(wl_unique_ptr<PangoLayout> layout) : pangoLayout {std::move(layout)} {}
int BarComponent::width() const
{
int w, h;
pango_layout_get_size(pangoLayout.get(), &w, &h);
return PANGO_PIXELS(w);
}
void BarComponent::setText(const std::string &text)
{
auto chars = new char[text.size()];
text.copy(chars, text.size());
_text.reset(chars);
pango_layout_set_text(pangoLayout.get(), chars, text.size());
}
Bar::Bar(Monitor *mon) Bar::Bar(Monitor *mon)
{ {
_mon = mon; _mon = mon;
_pangoContext.reset(pango_font_map_create_context(pango_cairo_font_map_get_default()));
for (auto i=0u; i<tagNames.size(); i++) { for (auto i=0u; i<tagNames.size(); i++) {
_tags.push_back({ ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_NONE, 0, 0, 0 }); _tags.push_back({ ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_NONE, 0, 0, createComponent(tagNames[i]) });
} }
_layoutCmp = createComponent();
_titleCmp = createComponent();
_statusCmp = createComponent();
} }
const wl_surface* Bar::surface() const { return _surface.get(); }
void Bar::create(wl_output *output) void Bar::create(wl_output *output)
{ {
_surface.reset(wl_compositor_create_surface(compositor)); _surface.reset(wl_compositor_create_surface(compositor));
@ -50,27 +88,47 @@ void Bar::create(wl_output *output)
zwlr_layer_surface_v1_set_anchor(_layerSurface.get(), zwlr_layer_surface_v1_set_anchor(_layerSurface.get(),
anchor | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT); anchor | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT);
auto barSize = fontMetrics.ascent() + fontMetrics.descent() + paddingY * 2; auto barSize = barfont.height + paddingY * 2;
_textY = fontMetrics.ascent() + paddingY;
zwlr_layer_surface_v1_set_size(_layerSurface.get(), 0, barSize); zwlr_layer_surface_v1_set_size(_layerSurface.get(), 0, barSize);
zwlr_layer_surface_v1_set_exclusive_zone(_layerSurface.get(), barSize); zwlr_layer_surface_v1_set_exclusive_zone(_layerSurface.get(), barSize);
wl_surface_commit(_surface.get()); wl_surface_commit(_surface.get());
} }
void Bar::setTag(int tag, znet_tapesoftware_dwl_wm_monitor_v1_tag_state state, int numClients, int focusedClient)
{
auto& t = _tags[tag];
t.state = state;
t.numClients = numClients;
t.focusedClient = focusedClient;
}
void Bar::setSelected(bool selected) { _selected = selected; }
void Bar::setLayout(int layout) { _layoutCmp.setText(layoutNames[layout]); }
void Bar::setTitle(const std::string &title) { _titleCmp.setText(title); }
void Bar::setStatus(const std::string &status) { _statusCmp.setText(status); }
void Bar::invalidate()
{
if (_invalid) return;
_invalid = true;
auto frame = wl_surface_frame(_surface.get());
wl_callback_add_listener(frame, &_frameListener, this);
wl_surface_commit(_surface.get());
}
void Bar::click(int x, int, int btn) void Bar::click(int x, int, int btn)
{ {
Arg arg = {0}; Arg arg = {0};
Arg *argp = nullptr; Arg *argp = nullptr;
int control = ClkNone; int control = ClkNone;
if (x > _statusX) { if (x > _statusCmp.x) {
control = ClkStatusText; control = ClkStatusText;
} else if (x > _titleX) { } else if (x > _titleCmp.x) {
control = ClkWinTitle; control = ClkWinTitle;
} else if (x > _layoutX) { } else if (x > _layoutCmp.x) {
control = ClkLayoutSymbol; control = ClkLayoutSymbol;
} else for (auto tag = _tags.size()-1; tag >= 0; tag--) { } else for (auto tag = _tags.size()-1; tag >= 0; tag--) {
if (x > _tags[tag].x) { if (x > _tags[tag].component.x) {
control = ClkTagBar; control = ClkTagBar;
arg.ui = 1<<tag; arg.ui = 1<<tag;
argp = &arg; argp = &arg;
@ -86,28 +144,6 @@ void Bar::click(int x, int, int btn)
} }
} }
void Bar::invalidate()
{
if (_invalid) return;
_invalid = true;
auto frame = wl_surface_frame(_surface.get());
wl_callback_add_listener(frame, &_frameListener, this);
wl_surface_commit(_surface.get());
}
void Bar::setTag(int tag, znet_tapesoftware_dwl_wm_monitor_v1_tag_state state, int numClients, int focusedClient)
{
auto& t = _tags[tag];
t.state = state;
t.numClients = numClients;
t.focusedClient = focusedClient;
}
void Bar::setSelected(bool selected) { _selected = selected; }
void Bar::setLayout(int layout) { _layout = layout; }
void Bar::setTitle(const char *title) { _title = title; }
void Bar::setStatus(const QString &status) { _status = status; }
void Bar::layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height) void Bar::layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height)
{ {
zwlr_layer_surface_v1_ack_configure(_layerSurface.get(), serial); zwlr_layer_surface_v1_ack_configure(_layerSurface.get(), serial);
@ -117,24 +153,22 @@ void Bar::layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height
void Bar::render() void Bar::render()
{ {
auto img = QImage { auto img = wl_unique_ptr<cairo_surface_t> {cairo_image_surface_create_for_data(
_bufs->data(), _bufs->data(),
CAIRO_FORMAT_ARGB32,
_bufs->width, _bufs->width,
_bufs->height, _bufs->height,
_bufs->stride, _bufs->stride
QImage::Format_ARGB32 )};
}; auto painter = wl_unique_ptr<cairo_t> {cairo_create(img.get())};
auto painter = QPainter {&img}; _painter = painter.get();
_painter = &painter; pango_cairo_update_context(_painter, _pangoContext.get());
_x = 0; _x = 0;
painter.setFont(font);
renderTags(); renderTags();
setColorScheme(_selected ? colorActive : colorInactive); setColorScheme(_selected ? colorActive : colorInactive);
_layoutX = _x; renderComponent(_layoutCmp);
renderText(layoutNames[_layout]); renderComponent(_titleCmp);
_titleX = _x;
renderText(_title);
renderStatus(); renderStatus();
_painter = nullptr; _painter = nullptr;
@ -145,50 +179,68 @@ void Bar::render()
_invalid = false; _invalid = false;
} }
void Bar::setColorScheme(const ColorScheme &scheme, bool invert)
{
_painter->setBrush(QBrush {invert ? scheme.fg : scheme.bg});
_painter->setPen(QPen {QBrush {invert ? scheme.bg : scheme.fg}, 1});
}
void Bar::renderTags() void Bar::renderTags()
{ {
for (auto i=0u; i<_tags.size(); i++) { for (auto &tag : _tags) {
auto& tag = _tags[i];
tag.x = _x;
setColorScheme( setColorScheme(
tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE ? colorActive : colorInactive, tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE ? colorActive : colorInactive,
tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT); tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT);
renderText(tagNames[i]); renderComponent(tag.component);
auto indicators = qMin(tag.numClients, _bufs->height/2); auto indicators = std::min(tag.numClients, _bufs->height/2);
for (auto ind = 0; ind < indicators; ind++) { for (auto ind = 0; ind < indicators; ind++) {
if (ind == tag.focusedClient) { auto w = ind == tag.focusedClient ? 7 : 1;
_painter->drawLine(tag.x, ind*2, tag.x+5, ind*2); cairo_move_to(_painter, tag.component.x, ind*2+0.5);
} else { cairo_rel_line_to(_painter, w, 0);
_painter->drawPoint(tag.x, ind*2); cairo_close_path(_painter);
cairo_set_line_width(_painter, 1);
cairo_stroke(_painter);
} }
} }
}
}
void Bar::renderText(const QString &text)
{
auto size = textWidth(text) + paddingX*2;
_painter->fillRect(_x, 0, size, _bufs->height, _painter->brush());
_painter->drawText(paddingX+_x, _textY, text);
_x += size;
} }
void Bar::renderStatus() void Bar::renderStatus()
{ {
_painter->fillRect(_x, 0, _bufs->width-_x, _bufs->height, _painter->brush()); pango_cairo_update_layout(_painter, _statusCmp.pangoLayout.get());
auto size = textWidth(_status) + paddingX; beginBg();
_statusX = _bufs->width - size; auto start = _bufs->width - _statusCmp.width() - paddingX*2;
_painter->drawText(paddingX+_statusX, _textY, _status); cairo_rectangle(_painter, _x, 0, _bufs->width-_x+start, _bufs->height);
_x = _bufs->width; cairo_fill(_painter);
_x = start;
renderComponent(_statusCmp);
} }
int Bar::textWidth(const QString &text) void Bar::setColorScheme(const ColorScheme &scheme, bool invert)
{ {
return fontMetrics.size(Qt::TextSingleLine, text).width(); _colorScheme = invert
? ColorScheme {scheme.bg, scheme.fg}
: ColorScheme {scheme.fg, scheme.bg};
}
static void setColor(cairo_t *painter, const Color &color) { cairo_set_source_rgba(painter, color.r/255.0, color.g/255.0, color.b/255.0, color.a/255.0); }
void Bar::beginFg() { setColor(_painter, _colorScheme.fg); }
void Bar::beginBg() { setColor(_painter, _colorScheme.bg); }
void Bar::renderComponent(BarComponent &component)
{
pango_cairo_update_layout(_painter, component.pangoLayout.get());
auto size = component.width() + paddingX*2;
component.x = _x;
beginBg();
cairo_rectangle(_painter, _x, 0, size, _bufs->height);
cairo_fill(_painter);
cairo_move_to(_painter, _x+paddingX, paddingY);
beginFg();
pango_cairo_show_layout(_painter, component.pangoLayout.get());
_x += size;
}
BarComponent Bar::createComponent(const std::string &initial)
{
auto layout = pango_layout_new(_pangoContext.get());
pango_layout_set_font_description(layout, barfont.description);
auto res = BarComponent {wl_unique_ptr<PangoLayout> {layout}};
res.setText(initial);
return res;
} }

View File

@ -3,20 +3,29 @@
#pragma once #pragma once
#include <optional> #include <optional>
#include <string>
#include <vector> #include <vector>
#include <wayland-client.h> #include <wayland-client.h>
#include <QString>
#include <QFontMetrics>
#include <QPainter>
#include "wlr-layer-shell-unstable-v1-client-protocol.h" #include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "common.hpp" #include "common.hpp"
#include "shm_buffer.hpp" #include "shm_buffer.hpp"
class BarComponent {
std::unique_ptr<char[]> _text;
public:
BarComponent();
explicit BarComponent(wl_unique_ptr<PangoLayout> layout);
int width() const;
void setText(const std::string &text);
wl_unique_ptr<PangoLayout> pangoLayout;
int x {0};
};
struct Tag { struct Tag {
znet_tapesoftware_dwl_wm_monitor_v1_tag_state state; znet_tapesoftware_dwl_wm_monitor_v1_tag_state state;
int numClients; int numClients;
int focusedClient; int focusedClient;
int x; BarComponent component;
}; };
struct Monitor; struct Monitor;
@ -26,35 +35,39 @@ class Bar {
wl_unique_ptr<wl_surface> _surface; wl_unique_ptr<wl_surface> _surface;
wl_unique_ptr<zwlr_layer_surface_v1> _layerSurface; wl_unique_ptr<zwlr_layer_surface_v1> _layerSurface;
wl_unique_ptr<PangoContext> _pangoContext;
Monitor *_mon; Monitor *_mon;
QPainter *_painter {nullptr};
std::optional<ShmBuffer> _bufs; std::optional<ShmBuffer> _bufs;
int _textY, _x; std::vector<Tag> _tags;
int _statusX, _titleX, _layoutX; BarComponent _layoutCmp, _titleCmp, _statusCmp;
bool _selected;
bool _invalid {false}; bool _invalid {false};
std::vector<Tag> _tags; // only vaild during render()
int _layout; cairo_t *_painter {nullptr};
bool _selected; int _x;
QString _title; ColorScheme _colorScheme;
QString _status;
void layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height); void layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height);
void render(); void render();
void renderTags(); void renderTags();
void renderStatus(); void renderStatus();
void renderText(const QString &text);
int textWidth(const QString &text); // low-level rendering
void setColorScheme(const ColorScheme &scheme, bool invert=false); void setColorScheme(const ColorScheme &scheme, bool invert=false);
void beginFg();
void beginBg();
void renderComponent(BarComponent &component);
BarComponent createComponent(const std::string &initial = {});
public: public:
Bar(Monitor *mon); Bar(Monitor *mon);
const wl_surface* surface() const; const wl_surface* surface() const;
void create(wl_output *output); void create(wl_output *output);
void setSelected(bool selected);
void setTag(int tag, znet_tapesoftware_dwl_wm_monitor_v1_tag_state state, int numClients, int focusedClient); void setTag(int tag, znet_tapesoftware_dwl_wm_monitor_v1_tag_state state, int numClients, int focusedClient);
void setSelected(bool selected);
void setLayout(int layout); void setLayout(int layout);
void setTitle(const char *title); void setTitle(const std::string &title);
void setStatus(const QString &status); void setStatus(const std::string &status);
void invalidate(); void invalidate();
void click(int x, int y, int btn); void click(int x, int y, int btn);
}; };

View File

@ -3,16 +3,22 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <string>
#include <vector> #include <vector>
#include <wayland-client.h> #include <wayland-client.h>
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <QColor> #include <cairo/cairo.h>
#include <QString> #include <pango/pango.h>
#include "wlr-layer-shell-unstable-v1-client-protocol.h" #include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h" #include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h"
struct Color {
Color() {}
constexpr Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255) : r(r), g(g), b(b), a(a) { }
uint8_t r, g, b, a {255};
};
struct ColorScheme { struct ColorScheme {
QColor fg, bg; Color fg, bg;
}; };
union Arg { union Arg {
unsigned int ui; unsigned int ui;
@ -32,8 +38,8 @@ extern wl_display *display;
extern wl_compositor *compositor; extern wl_compositor *compositor;
extern wl_shm *shm; extern wl_shm *shm;
extern zwlr_layer_shell_v1 *wlrLayerShell; extern zwlr_layer_shell_v1 *wlrLayerShell;
extern std::vector<QString> tagNames; extern std::vector<std::string> tagNames;
extern std::vector<QString> layoutNames; extern std::vector<std::string> layoutNames;
void view(Monitor &m, const Arg &arg); void view(Monitor &m, const Arg &arg);
void toggleview(Monitor &m, const Arg &arg); void toggleview(Monitor &m, const Arg &arg);
@ -57,3 +63,9 @@ WL_DELETER(wl_seat, wl_seat_release);
WL_DELETER(wl_surface, wl_surface_destroy); WL_DELETER(wl_surface, wl_surface_destroy);
WL_DELETER(znet_tapesoftware_dwl_wm_monitor_v1, znet_tapesoftware_dwl_wm_monitor_v1_release); WL_DELETER(znet_tapesoftware_dwl_wm_monitor_v1, znet_tapesoftware_dwl_wm_monitor_v1_release);
WL_DELETER(zwlr_layer_surface_v1, zwlr_layer_surface_v1_destroy); WL_DELETER(zwlr_layer_surface_v1, zwlr_layer_surface_v1_destroy);
WL_DELETER(cairo_t, cairo_destroy);
WL_DELETER(cairo_surface_t, cairo_surface_destroy);
WL_DELETER(PangoContext, g_object_unref);
WL_DELETER(PangoLayout, g_object_unref);

View File

@ -9,12 +9,11 @@ constexpr bool topbar = true;
constexpr int paddingX = 10; constexpr int paddingX = 10;
constexpr int paddingY = 3; constexpr int paddingY = 3;
constexpr const char *fontFamily = "Source Sans Pro"; // See https://docs.gtk.org/Pango/type_func.FontDescription.from_string.html
constexpr int fontSizePt = 12; constexpr const char *font = "Source Sans Pro 12";
constexpr bool fontBold = false;
constexpr ColorScheme colorInactive = {QColor(0xbb, 0xbb, 0xbb), QColor(0x22, 0x22, 0x22)}; constexpr ColorScheme colorInactive = {Color(0xbb, 0xbb, 0xbb), Color(0x22, 0x22, 0x22)};
constexpr ColorScheme colorActive = {QColor(0xee, 0xee, 0xee), QColor(0x00, 0x55, 0x77)}; constexpr ColorScheme colorActive = {Color(0xee, 0xee, 0xee), Color(0x00, 0x55, 0x77)};
constexpr const char *termcmd[] = {"foot", nullptr}; constexpr const char *termcmd[] = {"foot", nullptr};
constexpr Button buttons[] = { constexpr Button buttons[] = {

View File

@ -1,10 +1,14 @@
// somebar - dwl bar // somebar - dwl bar
// See LICENSE file for copyright and license details. // See LICENSE file for copyright and license details.
#include <cstdio> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <math.h> #include <math.h>
#include <signal.h> #include <signal.h>
#include <algorithm>
#include <list>
#include <optional>
#include <vector>
#include <sys/epoll.h> #include <sys/epoll.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/signalfd.h> #include <sys/signalfd.h>
@ -12,13 +16,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <list>
#include <optional>
#include <vector>
#include <wayland-client.h> #include <wayland-client.h>
#include <wayland-cursor.h> #include <wayland-cursor.h>
#include <QGuiApplication>
#include <QString>
#include "wlr-layer-shell-unstable-v1-client-protocol.h" #include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "xdg-shell-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h" #include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h"
@ -57,15 +56,15 @@ wl_compositor *compositor;
wl_shm *shm; wl_shm *shm;
zwlr_layer_shell_v1 *wlrLayerShell; zwlr_layer_shell_v1 *wlrLayerShell;
znet_tapesoftware_dwl_wm_v1 *dwlWm; znet_tapesoftware_dwl_wm_v1 *dwlWm;
std::vector<QString> tagNames; std::vector<std::string> tagNames;
std::vector<QString> layoutNames; std::vector<std::string> layoutNames;
static xdg_wm_base *xdgWmBase; static xdg_wm_base *xdgWmBase;
static wl_surface *cursorSurface; static wl_surface *cursorSurface;
static wl_cursor_image *cursorImage; static wl_cursor_image *cursorImage;
static bool ready; static bool ready;
static std::list<Monitor> monitors; static std::list<Monitor> monitors;
static std::list<Seat> seats; static std::list<Seat> seats;
static QString lastStatus; static std::string lastStatus;
static std::string statusFifoName; static std::string statusFifoName;
static int epoll {-1}; static int epoll {-1};
static int displayFd {-1}; static int displayFd {-1};
@ -277,7 +276,7 @@ static void onStatus()
{ {
char buffer[512]; char buffer[512];
auto n = read(statusFifoFd, buffer, sizeof(buffer)); auto n = read(statusFifoFd, buffer, sizeof(buffer));
lastStatus = QString::fromUtf8(buffer, n); lastStatus = {buffer, (unsigned long) n};
for (auto &monitor : monitors) { for (auto &monitor : monitors) {
if (monitor.bar) { if (monitor.bar) {
monitor.bar->setStatus(lastStatus); monitor.bar->setStatus(lastStatus);
@ -343,8 +342,6 @@ int main(int argc, char **argv)
sigaddset(&blockedsigs, SIGTERM); sigaddset(&blockedsigs, SIGTERM);
sigprocmask(SIG_BLOCK, &blockedsigs, nullptr); sigprocmask(SIG_BLOCK, &blockedsigs, nullptr);
QGuiApplication app {argc, argv};
epoll_event epollEv = {0}; epoll_event epollEv = {0};
std::array<epoll_event, 5> epollEvents; std::array<epoll_event, 5> epollEvents;
epoll = epoll_create1(EPOLL_CLOEXEC); epoll = epoll_create1(EPOLL_CLOEXEC);