Skip to content

Commit

Permalink
Merge pull request #2280 from zjeffer/fix/hyprland/workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays authored Jul 4, 2023
2 parents 5f29e5a + 7ef80d5 commit 18f5af8
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/modules/gamemode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "glibmm/varianttype.h"
#include "gtkmm/label.h"
#include "gtkmm/tooltip.h"

#include "util/gtk_icon.hpp"

namespace waybar::modules {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void Workspaces::remove_workspace(int id) {
[&](std::unique_ptr<Workspace> &x) { return x->id() == id; });

if (workspace == workspaces_.end()) {
spdlog::warn("Can't find workspace with id {}", workspace->get()->id());
spdlog::warn("Can't find workspace with id {}", id);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/sway/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <regex>
#include <string>

#include "util/rewrite_string.hpp"
#include "util/gtk_icon.hpp"
#include "util/rewrite_string.hpp"

namespace waybar::modules::sway {

Expand Down
1 change: 0 additions & 1 deletion src/modules/upower/upower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <string>

#include "gtkmm/tooltip.h"

#include "util/gtk_icon.hpp"

namespace waybar::modules::upower {
Expand Down
1 change: 0 additions & 1 deletion src/modules/upower/upower_tooltip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "gtkmm/enums.h"
#include "gtkmm/image.h"
#include "gtkmm/label.h"

#include "util/gtk_icon.hpp"

namespace waybar::modules::upower {
Expand Down
7 changes: 3 additions & 4 deletions src/util/gtk_icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
* access can cause data corruption and lead to invalid memory access and crashes.
* Even concurrent calls that seem read only such as has_icon can cause issues because
* the GTK lib may update the internal icon cache on this calls.
*/
*/

std::mutex DefaultGtkIconThemeWrapper::default_theme_mutex;

bool DefaultGtkIconThemeWrapper::has_icon(const std::string& value) {

const std::lock_guard<std::mutex> lock(default_theme_mutex);

return Gtk::IconTheme::get_default()->has_icon(value);
}

Glib::RefPtr<Gdk::Pixbuf> DefaultGtkIconThemeWrapper::load_icon(const char *name, int tmp_size, Gtk::IconLookupFlags flags) {

Glib::RefPtr<Gdk::Pixbuf> DefaultGtkIconThemeWrapper::load_icon(const char* name, int tmp_size,
Gtk::IconLookupFlags flags) {
const std::lock_guard<std::mutex> lock(default_theme_mutex);

auto default_theme = Gtk::IconTheme::get_default();
Expand Down

0 comments on commit 18f5af8

Please sign in to comment.