]> git.pld-linux.org Git - packages/waybar.git/blob - libfmt9.patch
d9a6aae3edf1b05395c2451ff224bc3bb4d32ebb
[packages/waybar.git] / libfmt9.patch
1 From 24a8332b62b5c1c8d480116655ce9c582d1f4516 Mon Sep 17 00:00:00 2001
2 From: Aleksei Bavshin <alebastr89@gmail.com>
3 Date: Mon, 11 Jul 2022 22:52:33 -0700
4 Subject: [PATCH 1/3] fix: adapt to fmt 9.0.0 breaking changes
5
6 ---
7  include/util/json.hpp    | 8 ++++++++
8  src/client.cpp           | 2 +-
9  src/config.cpp           | 1 -
10  src/modules/sni/host.cpp | 1 -
11  src/modules/sway/bar.cpp | 1 -
12  5 files changed, 9 insertions(+), 4 deletions(-)
13
14 diff --git a/include/util/json.hpp b/include/util/json.hpp
15 index cc514e139..7cd43552b 100644
16 --- a/include/util/json.hpp
17 +++ b/include/util/json.hpp
18 @@ -1,7 +1,15 @@
19  #pragma once
20  
21 +#include <fmt/ostream.h>
22  #include <json/json.h>
23  
24 +#if (FMT_VERSION >= 90000)
25 +
26 +template <>
27 +struct fmt::formatter<Json::Value> : ostream_formatter {};
28 +
29 +#endif
30 +
31  namespace waybar::util {
32  
33  struct JsonParser {
34 diff --git a/src/client.cpp b/src/client.cpp
35 index be2ec9178..a815e2fe1 100644
36 --- a/src/client.cpp
37 +++ b/src/client.cpp
38 @@ -1,12 +1,12 @@
39  #include "client.hpp"
40  
41 -#include <fmt/ostream.h>
42  #include <spdlog/spdlog.h>
43  
44  #include <iostream>
45  
46  #include "idle-inhibit-unstable-v1-client-protocol.h"
47  #include "util/clara.hpp"
48 +#include "util/format.hpp"
49  #include "wlr-layer-shell-unstable-v1-client-protocol.h"
50  
51  waybar::Client *waybar::Client::inst() {
52 diff --git a/src/config.cpp b/src/config.cpp
53 index 5894cb6b1..dec3b50b2 100644
54 --- a/src/config.cpp
55 +++ b/src/config.cpp
56 @@ -1,6 +1,5 @@
57  #include "config.hpp"
58  
59 -#include <fmt/ostream.h>
60  #include <spdlog/spdlog.h>
61  #include <unistd.h>
62  #include <wordexp.h>
63 diff --git a/src/modules/sni/host.cpp b/src/modules/sni/host.cpp
64 index 560d7368b..007862dcc 100644
65 --- a/src/modules/sni/host.cpp
66 +++ b/src/modules/sni/host.cpp
67 @@ -1,6 +1,5 @@
68  #include "modules/sni/host.hpp"
69  
70 -#include <fmt/ostream.h>
71  #include <spdlog/spdlog.h>
72  
73  namespace waybar::modules::SNI {
74 diff --git a/src/modules/sway/bar.cpp b/src/modules/sway/bar.cpp
75 index 26234e3b5..f28b05025 100644
76 --- a/src/modules/sway/bar.cpp
77 +++ b/src/modules/sway/bar.cpp
78 @@ -1,6 +1,5 @@
79  #include "modules/sway/bar.hpp"
80  
81 -#include <fmt/ostream.h>
82  #include <spdlog/spdlog.h>
83  
84  #include <sstream>
85
86 From 3117aefdf3e0bcae6671ab4669241c934bc9ec50 Mon Sep 17 00:00:00 2001
87 From: Aleksei Bavshin <alebastr89@gmail.com>
88 Date: Tue, 12 Jul 2022 22:20:49 -0700
89 Subject: [PATCH 2/3] fix: drop conditionals for ancient fmt versions
90
91 ---
92  include/modules/keyboard_state.hpp | 5 -----
93  include/modules/simpleclock.hpp    | 6 +-----
94  src/modules/clock.cpp              | 9 ++-------
95  3 files changed, 3 insertions(+), 17 deletions(-)
96
97 diff --git a/include/modules/keyboard_state.hpp b/include/modules/keyboard_state.hpp
98 index 6af19d145..05fbec131 100644
99 --- a/include/modules/keyboard_state.hpp
100 +++ b/include/modules/keyboard_state.hpp
101 @@ -1,11 +1,6 @@
102  #pragma once
103  
104 -#include <fmt/format.h>
105 -#if FMT_VERSION < 60000
106 -#include <fmt/time.h>
107 -#else
108  #include <fmt/chrono.h>
109 -#endif
110  #include <gtkmm/label.h>
111  
112  #include "AModule.hpp"
113 diff --git a/include/modules/simpleclock.hpp b/include/modules/simpleclock.hpp
114 index aa9a0a224..5cbee4c6c 100644
115 --- a/include/modules/simpleclock.hpp
116 +++ b/include/modules/simpleclock.hpp
117 @@ -1,11 +1,7 @@
118  #pragma once
119  
120 -#include <fmt/format.h>
121 -#if FMT_VERSION < 60000
122 -#include <fmt/time.h>
123 -#else
124  #include <fmt/chrono.h>
125 -#endif
126 +
127  #include "ALabel.hpp"
128  #include "util/sleeper_thread.hpp"
129  
130 diff --git a/src/modules/clock.cpp b/src/modules/clock.cpp
131 index 959cad903..467536e1e 100644
132 --- a/src/modules/clock.cpp
133 +++ b/src/modules/clock.cpp
134 @@ -1,15 +1,10 @@
135  #include "modules/clock.hpp"
136  
137 -#include <spdlog/spdlog.h>
138 -
139 -#include <iomanip>
140 -#if FMT_VERSION < 60000
141 -#include <fmt/time.h>
142 -#else
143  #include <fmt/chrono.h>
144 -#endif
145 +#include <spdlog/spdlog.h>
146  
147  #include <ctime>
148 +#include <iomanip>
149  #include <sstream>
150  #include <type_traits>
151  
152
153 From a44622aa9ff4b85c5eeb54663ecf9d7fe617bc08 Mon Sep 17 00:00:00 2001
154 From: Aleksei Bavshin <alebastr89@gmail.com>
155 Date: Wed, 13 Jul 2022 22:34:29 -0700
156 Subject: [PATCH 3/3] fix: fmt 9.x deprecation warning for implicit enum
157  conversions
158
159 ---
160  src/modules/mpd/state.cpp | 7 +++++++
161  1 file changed, 7 insertions(+)
162
163 diff --git a/src/modules/mpd/state.cpp b/src/modules/mpd/state.cpp
164 index 4d1e8c91b..aa1a18f8e 100644
165 --- a/src/modules/mpd/state.cpp
166 +++ b/src/modules/mpd/state.cpp
167 @@ -10,6 +10,13 @@ namespace waybar::modules {
168  }  // namespace waybar::modules
169  #endif
170  
171 +#if FMT_VERSION >= 90000
172 +/* Satisfy fmt 9.x deprecation of implicit conversion of enums to int */
173 +auto format_as(enum mpd_idle val) {
174 +  return static_cast<std::underlying_type_t<enum mpd_idle>>(val);
175 +}
176 +#endif
177 +
178  namespace waybar::modules::detail {
179  
180  #define IDLE_RUN_NOIDLE_AND_CMD(...)                                      \
This page took 0.091778 seconds and 2 git commands to generate.