Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package polybar for openSUSE:Factory checked in at 2022-03-10 22:45:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/polybar (Old) and /work/SRC/openSUSE:Factory/.polybar.new.2349 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "polybar" Thu Mar 10 22:45:50 2022 rev:7 rq:960829 version:3.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/polybar/polybar.changes 2022-03-04 00:18:28.312295738 +0100 +++ /work/SRC/openSUSE:Factory/.polybar.new.2349/polybar.changes 2022-03-11 11:51:22.550986492 +0100 @@ -1,0 +2,15 @@ +Thu Mar 10 15:35:35 UTC 2022 - Michael Vetter <mvet...@suse.com> + +- Update to 3.6.1: + * Fixed compiler warning in Clang 13 (#2613) + * Fixed compiler error in GCC 12 (#2616, #2614) + * Fixed installation of docs when some are not generated + (man, html...) (#2612) + * Fix LDFLAGS not being respected (#2619) + * tray-offset-x, tray-offset-y, offset-x, and offset-y were + mistakenly capped below at 0 (#2620) + * custom/script: Polybar shutdown being stalled by hanging script + (#2621) + * polybar-msg: Wrong hint when using deprecated hook (#2624) + +------------------------------------------------------------------- Old: ---- polybar-3.6.0.tar.gz New: ---- polybar-3.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ polybar.spec ++++++ --- /var/tmp/diff_new_pack.D70zZL/_old 2022-03-11 11:51:23.062987094 +0100 +++ /var/tmp/diff_new_pack.D70zZL/_new 2022-03-11 11:51:23.066987099 +0100 @@ -17,7 +17,7 @@ Name: polybar -Version: 3.6.0 +Version: 3.6.1 Release: 0 Summary: A fast and easy-to-use status bar License: MIT ++++++ polybar-3.6.0.tar.gz -> polybar-3.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/CHANGELOG.md new/polybar-3.6.1/CHANGELOG.md --- old/polybar-3.6.0/CHANGELOG.md 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/CHANGELOG.md 2022-03-05 14:29:15.000000000 +0100 @@ -10,6 +10,18 @@ ## [Unreleased] +## [3.6.1] - 2022-03-05 +### Build +- Fixed compiler warning in Clang 13 ([`#2613`](https://github.com/polybar/polybar/pull/2613)) +- Fixed compiler error in GCC 12 ([`#2616`](https://github.com/polybar/polybar/pull/2616), [`#2614`](https://github.com/polybar/polybar/issues/2614)) +- Fixed installation of docs when some are not generated (man, html...) ([`#2612`](https://github.com/polybar/polybar/pull/2612)) +- Fix `LDFLAGS` not being respected ([`#2619`](https://github.com/polybar/polybar/pull/2619)) + +### Fixed +- `tray-offset-x`, `tray-offset-y`, `offset-x`, and `offset-y` were mistakenly capped below at 0 ([`#2620`](https://github.com/polybar/polybar/pull/2620)) +- `custom/script`: Polybar shutdown being stalled by hanging script ([`#2621`](https://github.com/polybar/polybar/pull/2621)) +- `polybar-msg`: Wrong hint when using deprecated `hook` ([`#2624`](https://github.com/polybar/polybar/pull/2624)) + ## [3.6.0] - 2022-03-01 ### Breaking - We added the backslash escape character (\\) for configuration values. This means that the literal backslash character now has special meaning in configuration files, therefore if you want to use it in a value as a literal backslash, you need to escape it with the backslash escape character. The parser logs an error if any unescaped backslashes are found in a value. This affects you only if you are using two consecutive backslashes in a config value, which will now be interpreted as a single literal backslash. ([`#2354`](https://github.com/polybar/polybar/issues/2354)) @@ -151,7 +163,8 @@ ### Fixed - Empty color values are no longer treated as invalid and no longer produce an error. -[Unreleased]: https://github.com/polybar/polybar/compare/3.6.0...HEAD +[Unreleased]: https://github.com/polybar/polybar/compare/3.6.1...HEAD +[3.6.1]: https://github.com/polybar/polybar/releases/tag/3.6.1 [3.6.0]: https://github.com/polybar/polybar/releases/tag/3.6.0 [3.5.7]: https://github.com/polybar/polybar/releases/tag/3.5.7 [3.5.6]: https://github.com/polybar/polybar/releases/tag/3.5.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/README.md new/polybar-3.6.1/README.md --- old/polybar-3.6.0/README.md 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/README.md 2022-03-05 14:29:15.000000000 +0100 @@ -24,7 +24,7 @@ **Polybar** aims to help users build beautiful and highly customizable status bars for their desktop environment, without the need of having a black belt in shell scripting. - + ## Table of Contents @@ -33,8 +33,7 @@ * [Contributing](#contributing) * [Getting started](#getting-started) * [Installation](#installation) - * [Configuration](#configuration) - * [Running](#running) + * [First Steps](#first-steps) * [Community](#community) * [Contributors](#contributors) * [Donations](#donations) @@ -128,35 +127,8 @@ If you can't find your distro here, you will have to [build from source](https://github.com/polybar/polybar/wiki/Compiling). -### Configuration - -Details on how to setup and configure the bar and each module have been moved to [the wiki](https://github.com/polybar/polybar/wiki/Configuration). - -#### Install the example configuration - -For a normal installation, polybar will install the example config to -`/usr/share/doc/polybar/config` or ` /usr/local/share/doc/polybar/config` -(depending on your install parameters) - -From there you can copy it to `~/.config/polybar/config` to get started (make -sure to backup any existing config file there). - -**Note:** This example file is meant to showcase available modules and -configuration options. -Running it as-is will work but many modules will likely not start because they -require machine-specific configuration and many of the font icons will not show -up because they require a very specific [font -configuration](https://github.com/polybar/polybar/wiki/Fonts). -We encourage you to use it as a reference when building -your own configuration. - -#### Launch the example bar -~~~ sh -$ polybar example -~~~ - -### Running -[See the wiki for details on how to run polybar](https://github.com/polybar/polybar/wiki). +### First Steps +[See the wiki for details on how to run and configure polybar](https://github.com/polybar/polybar/wiki). ## Community Want to get in touch? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/cmake/01-core.cmake new/polybar-3.6.1/cmake/01-core.cmake --- old/polybar-3.6.0/cmake/01-core.cmake 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/cmake/01-core.cmake 2022-03-05 14:29:15.000000000 +0100 @@ -15,7 +15,7 @@ option(BUILD_POLYBAR_MSG "Build polybar-msg" ${DEFAULT_ON}) option(BUILD_TESTS "Build testsuite" OFF) option(BUILD_DOC "Build documentation" ${DEFAULT_ON}) -option(BUILD_CONFIG "Generate sample configuration" ${DEFAULT_ON}) +option(BUILD_CONFIG "Generate default configuration" ${DEFAULT_ON}) option(BUILD_SHELL "Generate shell completion files" ${DEFAULT_ON}) include(CMakeDependentOption) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/cmake/05-summary.cmake new/polybar-3.6.1/cmake/05-summary.cmake --- old/polybar-3.6.0/cmake/05-summary.cmake 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/cmake/05-summary.cmake 2022-03-05 14:29:15.000000000 +0100 @@ -26,7 +26,7 @@ colored_option(" documentation" BUILD_DOC) colored_option(" html" BUILD_DOC_HTML) colored_option(" man" BUILD_DOC_MAN) -colored_option(" sample config" BUILD_CONFIG) +colored_option(" default config" BUILD_CONFIG) colored_option(" shell files" BUILD_SHELL) if (BUILD_LIBPOLY) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/cmake/cxx.cmake new/polybar-3.6.1/cmake/cxx.cmake --- old/polybar-3.6.0/cmake/cxx.cmake 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/cmake/cxx.cmake 2022-03-05 14:29:15.000000000 +0100 @@ -108,4 +108,4 @@ string(REPLACE ";" " " cxx_linker_flags_str "${cxx_linker_flags}") # TODO use target_link_options once min cmake version is >= 3.13 -set(CMAKE_EXE_LINKER_FLAGS "${cxx_linker_flags_str}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${cxx_linker_flags_str}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/doc/CMakeLists.txt new/polybar-3.6.1/doc/CMakeLists.txt --- old/polybar-3.6.0/doc/CMakeLists.txt 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/doc/CMakeLists.txt 2022-03-05 14:29:15.000000000 +0100 @@ -49,10 +49,12 @@ # Dummy target that depends on all documentation targets add_custom_target(doc ALL DEPENDS ${doc_targets}) -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ +if (BUILD_DOC_HTML) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc PATTERN ".buildinfo" EXCLUDE) +endif() install(FILES ${CMAKE_SOURCE_DIR}/CHANGELOG.md DESTINATION ${CMAKE_INSTALL_DOCDIR} @@ -62,14 +64,17 @@ DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples COMPONENT doc) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar.1 +if (BUILD_DOC_MAN) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar-msg.1 + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar-msg.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar.5 + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 COMPONENT doc) +endif() + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/doc/man/polybar.1.rst new/polybar-3.6.1/doc/man/polybar.1.rst --- old/polybar-3.6.0/doc/man/polybar.1.rst 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/doc/man/polybar.1.rst 2022-03-05 14:29:15.000000000 +0100 @@ -8,7 +8,7 @@ DESCRIPTION ----------- Polybar aims to help users build beautiful and highly customizable status bars for their desktop environment, without the need of having a black belt in shell scripting. -If the *BAR* argument is not provided and the configuration file only contains one bar definition, Polybar will display this bar. +If the *BAR* argument is not provided and the configuration file only contains one bar definition, polybar will display this bar. OPTIONS ------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/doc/user/ipc.rst new/polybar-3.6.1/doc/user/ipc.rst --- old/polybar-3.6.0/doc/user/ipc.rst 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/doc/user/ipc.rst 2022-03-05 14:29:15.000000000 +0100 @@ -40,6 +40,19 @@ .. note:: IPC messages are only sent to polybar instances running under the same user as ``polybar-msg`` is running as. + Concretely, ``polybar`` and ``polybar-msg`` use the + ``$XDG_RUNTIME_DIR`` environment variable in accordance with the `XDG + Base Directory Specification`_ to determine where to find the socket + to communicate. + + If ``polybar`` and ``polybar-msg`` don't have the same value for + ``$XDG_RUNTIME_DIR``, they will likely not be able to communicate. + The variable may not be set if you use ``su`` or ``sudo`` to execute + ``polybar-msg`` as a different user, often a full user session is + required. + + .. _XDG Base Directory Specification: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + The ``<type>`` argument is either :ref:`action <ipc-actions>` or :ref:`cmd <ipc-commands>`. The allowed values for ``<payload>`` depend on the type. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/include/cairo/context.hpp new/polybar-3.6.1/include/cairo/context.hpp --- old/polybar-3.6.0/include/cairo/context.hpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/include/cairo/context.hpp 2022-03-05 14:29:15.000000000 +0100 @@ -5,6 +5,7 @@ #include <algorithm> #include <cmath> #include <deque> +#include <iterator> #include "cairo/font.hpp" #include "cairo/surface.hpp" @@ -117,9 +118,12 @@ context& operator<<(const rounded_corners& c) { cairo_new_sub_path(m_c); - cairo_arc(m_c, c.x + c.w - c.radius.top_right, c.y + c.radius.top_right, c.radius.top_right, -90 * degree, 0 * degree); - cairo_arc(m_c, c.x + c.w - c.radius.bottom_right, c.y + c.h - c.radius.bottom_right, c.radius.bottom_right, 0 * degree, 90 * degree); - cairo_arc(m_c, c.x + c.radius.bottom_left, c.y + c.h - c.radius.bottom_left, c.radius.bottom_left, 90 * degree, 180 * degree); + cairo_arc( + m_c, c.x + c.w - c.radius.top_right, c.y + c.radius.top_right, c.radius.top_right, -90 * degree, 0 * degree); + cairo_arc(m_c, c.x + c.w - c.radius.bottom_right, c.y + c.h - c.radius.bottom_right, c.radius.bottom_right, + 0 * degree, 90 * degree); + cairo_arc(m_c, c.x + c.radius.bottom_left, c.y + c.h - c.radius.bottom_left, c.radius.bottom_left, 90 * degree, + 180 * degree); cairo_arc(m_c, c.x + c.radius.top_left, c.y + c.radius.top_left, c.radius.top_left, 180 * degree, 270 * degree); cairo_close_path(m_c); return *this; @@ -142,7 +146,8 @@ cairo_rel_line_to(m_c, 0, segment.w); break; } - cairo_arc_negative(m_c, segment.x, segment.y, segment.radius - segment.w, segment.angle_to * degree, segment.angle_from * degree); + cairo_arc_negative(m_c, segment.x, segment.y, segment.radius - segment.w, segment.angle_to * degree, + segment.angle_from * degree); cairo_close_path(m_c); return *this; } @@ -360,9 +365,9 @@ std::deque<pair<double, double>> m_points; int m_activegroups{0}; - private: - const double degree = M_PI / 180.0; + private: + const double degree = M_PI / 180.0; }; -} // namespace cairo +} // namespace cairo POLYBAR_NS_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/include/ipc/msg.hpp new/polybar-3.6.1/include/ipc/msg.hpp --- old/polybar-3.6.0/include/ipc/msg.hpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/include/ipc/msg.hpp 2022-03-05 14:29:15.000000000 +0100 @@ -2,6 +2,8 @@ #include "common.hpp" +#include <array> + POLYBAR_NS /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/include/modules/date.hpp new/polybar-3.6.1/include/modules/date.hpp --- old/polybar-3.6.0/include/modules/date.hpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/include/modules/date.hpp 2022-03-05 14:29:15.000000000 +0100 @@ -1,5 +1,6 @@ #pragma once +#include <atomic> #include <ctime> #include <iomanip> #include <iostream> @@ -44,6 +45,6 @@ std::atomic<bool> m_toggled{false}; }; -} // namespace modules +} // namespace modules POLYBAR_NS_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/include/modules/fs.hpp new/polybar-3.6.1/include/modules/fs.hpp --- old/polybar-3.6.0/include/modules/fs.hpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/include/modules/fs.hpp 2022-03-05 14:29:15.000000000 +0100 @@ -1,7 +1,5 @@ #pragma once -#include <utility> - #include "components/config.hpp" #include "modules/meta/timer_module.hpp" #include "settings.hpp" @@ -74,6 +72,6 @@ // used while formatting output size_t m_index{0_z}; }; -} // namespace modules +} // namespace modules POLYBAR_NS_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/include/modules/github.hpp new/polybar-3.6.1/include/modules/github.hpp --- old/polybar-3.6.0/include/modules/github.hpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/include/modules/github.hpp 2022-03-05 14:29:15.000000000 +0100 @@ -1,5 +1,7 @@ #pragma once +#include <atomic> + #include "modules/meta/timer_module.hpp" #include "settings.hpp" #include "utils/http.hpp" @@ -37,6 +39,6 @@ bool m_empty_notifications{false}; std::atomic<bool> m_offline{false}; }; -} // namespace modules +} // namespace modules POLYBAR_NS_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/include/utils/units.hpp new/polybar-3.6.1/include/utils/units.hpp --- old/polybar-3.6.0/include/utils/units.hpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/include/utils/units.hpp 2022-03-05 14:29:15.000000000 +0100 @@ -21,7 +21,8 @@ string extent_to_string(extent_val extent); - unsigned percentage_with_offset_to_pixel(percentage_with_offset g_format, double max, double dpi); + int percentage_with_offset_to_pixel(percentage_with_offset g_format, double max, double dpi); + unsigned percentage_with_offset_to_pixel_nonnegative(percentage_with_offset g_format, double max, double dpi); spacing_type parse_spacing_unit(const string& str); spacing_val parse_spacing(const string& str); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/include/x11/tray_manager.hpp new/polybar-3.6.1/include/x11/tray_manager.hpp --- old/polybar-3.6.0/include/x11/tray_manager.hpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/include/x11/tray_manager.hpp 2022-03-05 14:29:15.000000000 +0100 @@ -40,9 +40,6 @@ class bg_slice; struct tray_settings { - tray_settings() = default; - tray_settings& operator=(const tray_settings& o) = default; - alignment align{alignment::NONE}; bool running{false}; int rel_x{0}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/src/adapters/net_nl.cpp new/polybar-3.6.1/src/adapters/net_nl.cpp --- old/polybar-3.6.0/src/adapters/net_nl.cpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/src/adapters/net_nl.cpp 2022-03-05 14:29:15.000000000 +0100 @@ -1,9 +1,10 @@ -#include "adapters/net.hpp" - #include <linux/nl80211.h> #include <netlink/genl/ctrl.h> #include <netlink/genl/genl.h> +#include <algorithm> + +#include "adapters/net.hpp" #include "utils/file.hpp" POLYBAR_NS @@ -166,8 +167,8 @@ m_essid.clear(); if (bss[NL80211_BSS_INFORMATION_ELEMENTS] != nullptr) { - // Information Element ID from ieee80211.h - #define WLAN_EID_SSID 0 +// Information Element ID from ieee80211.h +#define WLAN_EID_SSID 0 auto ies = static_cast<char*>(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS])); auto ies_len = nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]); @@ -226,6 +227,6 @@ m_signalstrength.max = hardware_max - hardware_min; } } -} // namespace net +} // namespace net POLYBAR_NS_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/src/adapters/script_runner.cpp new/polybar-3.6.1/src/adapters/script_runner.cpp --- old/polybar-3.6.0/src/adapters/script_runner.cpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/src/adapters/script_runner.cpp 2022-03-05 14:29:15.000000000 +0100 @@ -96,16 +96,35 @@ auto cmd = command_util::make_command<output_policy::REDIRECTED>(exec); try { - cmd->exec(true, m_env); + cmd->exec(false, m_env); } catch (const exception& err) { m_log.err("script_runner: %s", err.what()); throw modules::module_error("Failed to execute command, stopping module..."); } - m_exit_status = cmd->get_exit_status(); int fd = cmd->get_stdout(PIPE_READ); assert(fd != -1); - bool changed = io_util::poll_read(fd) && set_output(cmd->readline()); + + bool changed = false; + + bool got_output = false; + while (!m_stopping && cmd->is_running() && !io_util::poll(fd, POLLHUP, 0)) { + /** + * For non-tailed scripts, we only use the first line. However, to ensure interruptability when the module shuts + * down, we still need to continue polling. + */ + if (io_util::poll_read(fd, 25) && !got_output) { + changed = set_output(cmd->readline()); + got_output = true; + } + } + + if (m_stopping) { + cmd->terminate(); + return 0s; + } + + m_exit_status = cmd->wait(); if (!changed && m_exit_status != 0) { clear_output(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/src/components/bar.cpp new/polybar-3.6.1/src/components/bar.cpp --- old/polybar-3.6.0/src/components/bar.cpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/src/components/bar.cpp 2022-03-05 14:29:15.000000000 +0100 @@ -221,8 +221,10 @@ // Load values used to adjust the struts atom auto margin_top = m_conf.get("global/wm", "margin-top", percentage_with_offset{}); auto margin_bottom = m_conf.get("global/wm", "margin-bottom", percentage_with_offset{}); - m_opts.strut.top = units_utils::percentage_with_offset_to_pixel(margin_top, m_opts.monitor->h, m_opts.dpi_y); - m_opts.strut.bottom = units_utils::percentage_with_offset_to_pixel(margin_bottom, m_opts.monitor->h, m_opts.dpi_y); + m_opts.strut.top = + units_utils::percentage_with_offset_to_pixel_nonnegative(margin_top, m_opts.monitor->h, m_opts.dpi_y); + m_opts.strut.bottom = + units_utils::percentage_with_offset_to_pixel_nonnegative(margin_bottom, m_opts.monitor->h, m_opts.dpi_y); // Load commands used for fallback click handlers vector<action> actions; @@ -295,19 +297,19 @@ m_opts.borders.emplace(edge::TOP, border_settings{}); m_opts.borders[edge::TOP].size = - units_utils::percentage_with_offset_to_pixel(border_top, m_opts.monitor->h, m_opts.dpi_y); + units_utils::percentage_with_offset_to_pixel_nonnegative(border_top, m_opts.monitor->h, m_opts.dpi_y); m_opts.borders[edge::TOP].color = parse_or_throw_color("border-top-color", border_color); m_opts.borders.emplace(edge::BOTTOM, border_settings{}); m_opts.borders[edge::BOTTOM].size = - units_utils::percentage_with_offset_to_pixel(border_bottom, m_opts.monitor->h, m_opts.dpi_y); + units_utils::percentage_with_offset_to_pixel_nonnegative(border_bottom, m_opts.monitor->h, m_opts.dpi_y); m_opts.borders[edge::BOTTOM].color = parse_or_throw_color("border-bottom-color", border_color); m_opts.borders.emplace(edge::LEFT, border_settings{}); m_opts.borders[edge::LEFT].size = - units_utils::percentage_with_offset_to_pixel(border_left, m_opts.monitor->w, m_opts.dpi_x); + units_utils::percentage_with_offset_to_pixel_nonnegative(border_left, m_opts.monitor->w, m_opts.dpi_x); m_opts.borders[edge::LEFT].color = parse_or_throw_color("border-left-color", border_color); m_opts.borders.emplace(edge::RIGHT, border_settings{}); m_opts.borders[edge::RIGHT].size = - units_utils::percentage_with_offset_to_pixel(border_right, m_opts.monitor->w, m_opts.dpi_x); + units_utils::percentage_with_offset_to_pixel_nonnegative(border_right, m_opts.monitor->w, m_opts.dpi_x); m_opts.borders[edge::RIGHT].color = parse_or_throw_color("border-right-color", border_color); // Load geometry values @@ -316,8 +318,8 @@ auto offsetx = m_conf.get(m_conf.section(), "offset-x", percentage_with_offset{}); auto offsety = m_conf.get(m_conf.section(), "offset-y", percentage_with_offset{}); - m_opts.size.w = units_utils::percentage_with_offset_to_pixel(w, m_opts.monitor->w, m_opts.dpi_x); - m_opts.size.h = units_utils::percentage_with_offset_to_pixel(h, m_opts.monitor->h, m_opts.dpi_y); + m_opts.size.w = units_utils::percentage_with_offset_to_pixel_nonnegative(w, m_opts.monitor->w, m_opts.dpi_x); + m_opts.size.h = units_utils::percentage_with_offset_to_pixel_nonnegative(h, m_opts.monitor->h, m_opts.dpi_y); m_opts.offset.x = units_utils::percentage_with_offset_to_pixel(offsetx, m_opts.monitor->w, m_opts.dpi_x); m_opts.offset.y = units_utils::percentage_with_offset_to_pixel(offsety, m_opts.monitor->h, m_opts.dpi_y); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/src/modules/fs.cpp new/polybar-3.6.1/src/modules/fs.cpp --- old/polybar-3.6.0/src/modules/fs.cpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/src/modules/fs.cpp 2022-03-05 14:29:15.000000000 +0100 @@ -3,6 +3,7 @@ #include <sys/statvfs.h> #include <fstream> +#include <utility> #include "drawtypes/label.hpp" #include "drawtypes/progressbar.hpp" @@ -206,6 +207,6 @@ return true; } -} // namespace modules +} // namespace modules POLYBAR_NS_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/src/polybar-msg.cpp new/polybar-3.6.1/src/polybar-msg.cpp --- old/polybar-3.6.0/src/polybar-msg.cpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/src/polybar-msg.cpp 2022-03-05 14:29:15.000000000 +0100 @@ -141,7 +141,7 @@ fprintf(stderr, "Warning: Using IPC hook commands is deprecated, use the hook action on the ipc module: %s %s \"%s\"\n", exec, - ipc_type.c_str(), ipc_payload.c_str()); + "action", ipc_payload.c_str()); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/src/utils/units.cpp new/polybar-3.6.1/src/utils/units.cpp --- old/polybar-3.6.0/src/utils/units.cpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/src/utils/units.cpp 2022-03-05 14:29:15.000000000 +0100 @@ -39,11 +39,14 @@ /** * Converts a percentage with offset into pixels */ - unsigned int percentage_with_offset_to_pixel(percentage_with_offset g_format, double max, double dpi) { + int percentage_with_offset_to_pixel(percentage_with_offset g_format, double max, double dpi) { int offset_pixel = extent_to_pixel(g_format.offset, dpi); - return static_cast<unsigned int>( - std::max<double>(0, math_util::percentage_to_value<double, double>(g_format.percentage, max) + offset_pixel)); + return static_cast<int>(math_util::percentage_to_value<double, double>(g_format.percentage, max) + offset_pixel); + } + + unsigned percentage_with_offset_to_pixel_nonnegative(percentage_with_offset g_format, double max, double dpi) { + return std::max<int>(0, percentage_with_offset_to_pixel(g_format, max, dpi)); } extent_type parse_extent_unit(const string& str) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/tests/unit_tests/utils/units.cpp new/polybar-3.6.1/tests/unit_tests/utils/units.cpp --- old/polybar-3.6.0/tests/unit_tests/utils/units.cpp 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/tests/unit_tests/utils/units.cpp 2022-03-05 14:29:15.000000000 +0100 @@ -6,7 +6,6 @@ using namespace polybar; using namespace units_utils; - namespace polybar { bool operator==(const extent_val lhs, const extent_val rhs) { return lhs.type == rhs.type && lhs.value == rhs.value; @@ -24,9 +23,9 @@ * value represents the format string. The max value is always 1000 and dpi is always 96 */ class GeomFormatToPixelsTest : public ::testing::Test, - public ::testing::WithParamInterface<pair<unsigned, percentage_with_offset>> {}; + public ::testing::WithParamInterface<pair<int, percentage_with_offset>> {}; -vector<pair<unsigned, percentage_with_offset>> to_pixels_no_offset_list = { +vector<pair<int, percentage_with_offset>> to_pixels_no_offset_list = { {1000, percentage_with_offset{100.}}, {0, percentage_with_offset{0.}}, {1000, percentage_with_offset{150.}}, @@ -36,34 +35,33 @@ {1, percentage_with_offset{0., extent_val{extent_type::PIXEL, 1}}}, }; -vector<pair<unsigned, percentage_with_offset>> to_pixels_with_offset_list = { +vector<pair<int, percentage_with_offset>> to_pixels_with_pixels_list = { {1000, percentage_with_offset{100., ZERO_PX_EXTENT}}, {1010, percentage_with_offset{100., extent_val{extent_type::PIXEL, 10}}}, {990, percentage_with_offset{100., extent_val{extent_type::PIXEL, -10}}}, {10, percentage_with_offset{0., extent_val{extent_type::PIXEL, 10}}}, {1000, percentage_with_offset{99., extent_val{extent_type::PIXEL, 10}}}, - {0, percentage_with_offset{1., extent_val{extent_type::PIXEL, -100}}}, + {-90, percentage_with_offset{1., extent_val{extent_type::PIXEL, -100}}}, }; -vector<pair<unsigned, percentage_with_offset>> to_pixels_with_units_list = { +vector<pair<int, percentage_with_offset>> to_pixels_with_points_list = { {1013, percentage_with_offset{100., extent_val{extent_type::POINT, 10}}}, {987, percentage_with_offset{100., extent_val{extent_type::POINT, -10}}}, {1003, percentage_with_offset{99., extent_val{extent_type::POINT, 10}}}, {13, percentage_with_offset{0., extent_val{extent_type::POINT, 10}}}, - {0, percentage_with_offset{0, extent_val{extent_type::POINT, -10}}}, }; INSTANTIATE_TEST_SUITE_P(NoOffset, GeomFormatToPixelsTest, ::testing::ValuesIn(to_pixels_no_offset_list)); -INSTANTIATE_TEST_SUITE_P(WithOffset, GeomFormatToPixelsTest, ::testing::ValuesIn(to_pixels_with_offset_list)); +INSTANTIATE_TEST_SUITE_P(WithPixels, GeomFormatToPixelsTest, ::testing::ValuesIn(to_pixels_with_pixels_list)); -INSTANTIATE_TEST_SUITE_P(WithUnits, GeomFormatToPixelsTest, ::testing::ValuesIn(to_pixels_with_units_list)); +INSTANTIATE_TEST_SUITE_P(WithPoints, GeomFormatToPixelsTest, ::testing::ValuesIn(to_pixels_with_points_list)); static constexpr int MAX_WIDTH = 1000; static constexpr int DPI = 96; TEST_P(GeomFormatToPixelsTest, correctness) { - unsigned exp = GetParam().first; + int exp = GetParam().first; percentage_with_offset geometry = GetParam().second; EXPECT_DOUBLE_EQ(exp, percentage_with_offset_to_pixel(geometry, MAX_WIDTH, DPI)); } @@ -83,17 +81,6 @@ EXPECT_EQ(0, extent_to_pixel_nonnegative({extent_type::POINT, -36}, 96)); } -TEST(UnitsUtils, percentage_with_offset_to_pixel) { - EXPECT_EQ(1100, percentage_with_offset_to_pixel({100, {extent_type::PIXEL, 100}}, 1000, 0)); - EXPECT_EQ(1048, percentage_with_offset_to_pixel({100, {extent_type::POINT, 36}}, 1000, 96)); - - EXPECT_EQ(900, percentage_with_offset_to_pixel({100, {extent_type::PIXEL, -100}}, 1000, 0)); - EXPECT_EQ(952, percentage_with_offset_to_pixel({100, {extent_type::POINT, -36}}, 1000, 96)); - - EXPECT_EQ(0, percentage_with_offset_to_pixel({0, {extent_type::PIXEL, -100}}, 1000, 0)); - EXPECT_EQ(100, percentage_with_offset_to_pixel({0, {extent_type::PIXEL, 100}}, 1000, 0)); -} - TEST(UnitsUtils, parse_extent_unit) { EXPECT_EQ(extent_type::PIXEL, parse_extent_unit("px")); EXPECT_EQ(extent_type::POINT, parse_extent_unit("pt")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polybar-3.6.0/version.txt new/polybar-3.6.1/version.txt --- old/polybar-3.6.0/version.txt 2022-03-01 19:28:29.000000000 +0100 +++ new/polybar-3.6.1/version.txt 2022-03-05 14:29:15.000000000 +0100 @@ -1,4 +1,4 @@ # Polybar version information # Update this on every release # This is used to create the version string if a git repo is not available -3.6.0 +3.6.1