mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix: cancel thread and fix window close
This commit is contained in:
@ -4,14 +4,15 @@
|
||||
#include <glibmm/markup.h>
|
||||
#include <gtkmm/eventbox.h>
|
||||
#include <json/json.h>
|
||||
|
||||
#include "IModule.hpp"
|
||||
|
||||
namespace waybar {
|
||||
|
||||
class AModule : public IModule {
|
||||
public:
|
||||
AModule(const Json::Value &, const std::string &, const std::string &,
|
||||
bool enable_click = false, bool enable_scroll = false);
|
||||
AModule(const Json::Value &, const std::string &, const std::string &, bool enable_click = false,
|
||||
bool enable_scroll = false);
|
||||
virtual ~AModule();
|
||||
virtual auto update() -> void;
|
||||
virtual operator Gtk::Widget &();
|
||||
@ -24,6 +25,7 @@ class AModule : public IModule {
|
||||
SCROLL_DIR getScrollDir(GdkEventScroll *e);
|
||||
bool tooltipEnabled();
|
||||
|
||||
const std::string name_;
|
||||
const Json::Value &config_;
|
||||
Gtk::EventBox event_box_;
|
||||
|
||||
|
@ -34,10 +34,10 @@ class Bar {
|
||||
|
||||
struct waybar_output *output;
|
||||
Json::Value config;
|
||||
Gtk::Window window;
|
||||
struct wl_surface * surface;
|
||||
bool visible = true;
|
||||
bool vertical = false;
|
||||
Gtk::Window window;
|
||||
|
||||
private:
|
||||
static constexpr const char *MIN_HEIGHT_MSG =
|
||||
|
@ -52,8 +52,6 @@ class Network : public ALabel {
|
||||
struct sockaddr_nl nladdr_ = {0};
|
||||
struct nl_sock* sock_ = nullptr;
|
||||
struct nl_sock* ev_sock_ = nullptr;
|
||||
int efd_;
|
||||
int ev_fd_;
|
||||
int nl80211_id_;
|
||||
std::mutex mutex_;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
namespace waybar::util {
|
||||
|
||||
class Rfkill {
|
||||
public:;
|
||||
public:
|
||||
Rfkill(enum rfkill_type rfkill_type);
|
||||
~Rfkill() = default;
|
||||
void waitForEvent();
|
||||
@ -13,7 +13,7 @@ class Rfkill {
|
||||
|
||||
private:
|
||||
enum rfkill_type rfkill_type_;
|
||||
int state_ = 0;
|
||||
int state_ = 0;
|
||||
};
|
||||
|
||||
} // namespace waybar::util
|
||||
|
@ -59,6 +59,11 @@ class SleeperThread {
|
||||
do_run_ = false;
|
||||
}
|
||||
condvar_.notify_all();
|
||||
auto handle = thread_.native_handle();
|
||||
if (handle != 0) {
|
||||
// TODO: find a proper way to terminate thread...
|
||||
pthread_cancel(handle);
|
||||
}
|
||||
}
|
||||
|
||||
~SleeperThread() {
|
||||
|
Reference in New Issue
Block a user