mirror of
https://github.com/polybar/polybar.git
synced 2026-02-20 04:45:38 +00:00
Support receiving IPC messages in multiple parts
This commit is contained in:
committed by
Patrick Ziegler
parent
dd4088910e
commit
db52106934
@ -57,7 +57,6 @@ class controller : public signal_receiver<SIGN_PRIORITY_CONTROLLER, signals::eve
|
||||
void signal_handler(int signum);
|
||||
|
||||
void conn_cb(int status, int events);
|
||||
void ipc_cb(string buf);
|
||||
void confwatch_handler(const char* fname, int events, int status);
|
||||
void notifier_handler();
|
||||
void screenshot_handler();
|
||||
|
||||
@ -79,11 +79,12 @@ struct FSEventHandle : public UVHandle<uv_fs_event_t, const char*, int, int> {
|
||||
};
|
||||
|
||||
struct PipeHandle : public UVHandleGeneric<uv_pipe_t, uv_stream_t, ssize_t, const uv_buf_t*> {
|
||||
PipeHandle(uv_loop_t* loop, std::function<void(const string)> fun);
|
||||
PipeHandle(uv_loop_t* loop, std::function<void(const string)> fun, std::function<void(void)> eof_cb);
|
||||
void start(int fd);
|
||||
void read_cb(ssize_t nread, const uv_buf_t* buf);
|
||||
|
||||
std::function<void(const string)> func;
|
||||
std::function<void(void)> eof_cb;
|
||||
int fd;
|
||||
};
|
||||
|
||||
@ -114,7 +115,7 @@ class eventloop {
|
||||
void signal_handler(int signum, std::function<void(int)> fun);
|
||||
void poll_handler(int events, int fd, std::function<void(int, int)> fun);
|
||||
void fs_event_handler(const string& path, std::function<void(const char*, int, int)> fun);
|
||||
void pipe_handle(int fd, std::function<void(const string)> fun);
|
||||
void pipe_handle(int fd, std::function<void(const string)> fun, std::function<void(void)> eof_cb);
|
||||
void timer_handle(uint64_t timeout, uint64_t repeat, std::function<void(void)> fun);
|
||||
AsyncHandle_t async_handle(std::function<void(void)> fun);
|
||||
|
||||
|
||||
@ -34,7 +34,8 @@ class ipc {
|
||||
explicit ipc(signal_emitter& emitter, const logger& logger);
|
||||
~ipc();
|
||||
|
||||
void receive_message(string buf);
|
||||
void receive_data(string buf);
|
||||
void receive_eof();
|
||||
int get_file_descriptor() const;
|
||||
|
||||
private:
|
||||
@ -42,7 +43,12 @@ class ipc {
|
||||
const logger& m_log;
|
||||
|
||||
string m_path{};
|
||||
unique_ptr<file_descriptor> m_fd;
|
||||
int m_fd;
|
||||
|
||||
/**
|
||||
* Buffer for the currently received IPC message.
|
||||
*/
|
||||
string m_buffer{};
|
||||
};
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
||||
Reference in New Issue
Block a user