workspace taskbars: Use sigc::mem_fun instead of lambda
This commit is contained in:
@ -88,7 +88,7 @@ class Workspace {
|
|||||||
Gtk::Label m_labelAfter;
|
Gtk::Label m_labelAfter;
|
||||||
|
|
||||||
void updateTaskbar(const std::string& workspace_icon);
|
void updateTaskbar(const std::string& workspace_icon);
|
||||||
static void focusWindow(WindowAddress const& addr);
|
bool handleClick(const GdkEventButton* event_button, WindowAddress const& addr) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace waybar::modules::hyprland
|
} // namespace waybar::modules::hyprland
|
||||||
|
@ -252,14 +252,7 @@ void Workspace::updateTaskbar(const std::string &workspace_icon) {
|
|||||||
auto event_box = Gtk::manage(new Gtk::EventBox());
|
auto event_box = Gtk::manage(new Gtk::EventBox());
|
||||||
event_box->add(*window_box);
|
event_box->add(*window_box);
|
||||||
event_box->signal_button_press_event().connect(
|
event_box->signal_button_press_event().connect(
|
||||||
[window_repr](GdkEventButton const *bt) {
|
sigc::bind(sigc::mem_fun(*this, &Workspace::handleClick), window_repr.address));
|
||||||
if (bt->type == GDK_BUTTON_PRESS) {
|
|
||||||
focusWindow(window_repr.address);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
false);
|
|
||||||
|
|
||||||
auto text_before = fmt::format(fmt::runtime(m_workspaceManager.taskbarFormatBefore()),
|
auto text_before = fmt::format(fmt::runtime(m_workspaceManager.taskbarFormatBefore()),
|
||||||
fmt::arg("title", window_repr.window_title));
|
fmt::arg("title", window_repr.window_title));
|
||||||
@ -297,12 +290,11 @@ void Workspace::updateTaskbar(const std::string &workspace_icon) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::focusWindow(WindowAddress const &addr) {
|
bool Workspace::handleClick(const GdkEventButton *event_button, WindowAddress const &addr) const {
|
||||||
try {
|
if (event_button->type == GDK_BUTTON_PRESS) {
|
||||||
IPC::getSocket1Reply("dispatch focuswindow address:0x" + addr);
|
IPC::getSocket1Reply("dispatch focuswindow address:0x" + addr);
|
||||||
} catch (const std::exception &e) {
|
|
||||||
spdlog::error("Failed to dispatch window: {}", e.what());
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace waybar::modules::hyprland
|
} // namespace waybar::modules::hyprland
|
||||||
|
Reference in New Issue
Block a user