From 6da4df255c8b0ea8463b36e12e173da9fd4fb182 Mon Sep 17 00:00:00 2001 From: Raphael Robatsch Date: Fri, 29 Oct 2021 23:23:35 +0200 Subject: [PATCH 1/2] style: fix spacing issues --- src/bar.cpp | 9 +++++---- src/line_buffer.hpp | 2 +- src/main.cpp | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/bar.cpp b/src/bar.cpp index bcc4c05..4ba2b3c 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -91,7 +91,7 @@ void Bar::show(wl_output* output) zwlr_layer_surface_v1_add_listener(_layerSurface.get(), &_layerSurfaceListener, this); auto anchor = topbar ? ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP : ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM; 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 = barfont.height + paddingY * 2; zwlr_layer_surface_v1_set_size(_layerSurface.get(), 0, barSize); @@ -196,8 +196,8 @@ void Bar::renderTags() { for (auto &tag : _tags) { setColorScheme( - 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_ACTIVE ? colorActive : colorInactive, + tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT); renderComponent(tag.component); auto indicators = std::min(tag.numClients, _bufs->height/2); for (auto ind = 0; ind < indicators; ind++) { @@ -231,7 +231,8 @@ void Bar::setColorScheme(const ColorScheme& scheme, bool invert) } 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); + 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); } diff --git a/src/line_buffer.hpp b/src/line_buffer.hpp index 5331bf2..1ccb184 100644 --- a/src/line_buffer.hpp +++ b/src/line_buffer.hpp @@ -34,7 +34,7 @@ public: resetBuffer(); } } - private: +private: template void dispatchLines(const Consumer& consumer) { diff --git a/src/main.cpp b/src/main.cpp index 68be4b4..6d44dd8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -97,7 +97,7 @@ void tag(Monitor& m, const Arg& arg) } void toggletag(Monitor& m, const Arg& arg) { - znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), 0xffffff, arg.ui); + znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), ~0, arg.ui); } void spawn(Monitor&, const Arg& arg) { @@ -150,7 +150,7 @@ static const struct wl_pointer_listener pointerListener = { wl_surface_commit(cursorSurface); } wl_pointer_set_cursor(pointer, serial, cursorSurface, - cursorImage->hotspot_x, cursorImage->hotspot_y); + cursorImage->hotspot_x, cursorImage->hotspot_y); }, .leave = [](void* sp, wl_pointer*, uint32_t serial, wl_surface*) { auto& seat = *static_cast(sp); From e2c4eb61857cbf468a8c7d9d54351441584c466b Mon Sep 17 00:00:00 2001 From: Raphael Robatsch Date: Fri, 29 Oct 2021 23:25:07 +0200 Subject: [PATCH 2/2] Bar::setLayout: take layout name instead of number --- src/bar.cpp | 2 +- src/bar.hpp | 2 +- src/main.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bar.cpp b/src/bar.cpp index 4ba2b3c..6ebbea2 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -115,7 +115,7 @@ void Bar::setTag(int tag, znet_tapesoftware_dwl_wm_monitor_v1_tag_state state, i t.focusedClient = focusedClient; } void Bar::setSelected(bool selected) { _selected = selected; } -void Bar::setLayout(int layout) { _layoutCmp.setText(layoutNames[layout]); } +void Bar::setLayout(const std::string& layout) { _layoutCmp.setText(layout); } void Bar::setTitle(const std::string& title) { _titleCmp.setText(title); } void Bar::setStatus(const std::string& status) { _statusCmp.setText(status); } diff --git a/src/bar.hpp b/src/bar.hpp index 4fc72e9..bddbbb6 100644 --- a/src/bar.hpp +++ b/src/bar.hpp @@ -67,7 +67,7 @@ public: void hide(); 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(const std::string& layout); void setTitle(const std::string& title); void setStatus(const std::string& status); void invalidate(); diff --git a/src/main.cpp b/src/main.cpp index 6d44dd8..d6debcb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -231,7 +231,7 @@ static const struct znet_tapesoftware_dwl_wm_monitor_v1_listener dwlWmMonitorLis }, .layout = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t layout) { auto mon = static_cast(mv); - mon->bar->setLayout(layout); + mon->bar->setLayout(layoutNames[layout]); }, .title = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, const char* title) { auto mon = static_cast(mv);