Merge pull request #13 from notfound4/dev
Full support of mode_event Added payload to mode event
This commit is contained in:
@@ -218,6 +218,15 @@ struct binding_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mode
|
||||||
|
*/
|
||||||
|
struct mode_t {
|
||||||
|
std::string change; ///< The current mode in use
|
||||||
|
bool pango_markup; ///< Should pango markup be used for displaying this mode
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bar configuration
|
* A bar configuration
|
||||||
*/
|
*/
|
||||||
@@ -340,7 +349,7 @@ public:
|
|||||||
|
|
||||||
sigc::signal<void, const workspace_event_t&> signal_workspace_event; ///< Workspace event signal
|
sigc::signal<void, const workspace_event_t&> signal_workspace_event; ///< Workspace event signal
|
||||||
sigc::signal<void> signal_output_event; ///< Output event signal
|
sigc::signal<void> signal_output_event; ///< Output event signal
|
||||||
sigc::signal<void> signal_mode_event; ///< Output mode event signal
|
sigc::signal<void, const mode_t&> signal_mode_event; ///< Output mode event signal
|
||||||
sigc::signal<void, const window_event_t&> signal_window_event; ///< Window event signal
|
sigc::signal<void, const window_event_t&> signal_window_event; ///< Window event signal
|
||||||
sigc::signal<void, const bar_config_t&> signal_barconfig_update_event; ///< Barconfig update event signal
|
sigc::signal<void, const bar_config_t&> signal_barconfig_update_event; ///< Barconfig update event signal
|
||||||
sigc::signal<void, const binding_t&> signal_binding_event; ///< Binding event signal
|
sigc::signal<void, const binding_t&> signal_binding_event; ///< Binding event signal
|
||||||
|
|||||||
20
src/ipc.cpp
20
src/ipc.cpp
@@ -188,6 +188,18 @@ static std::shared_ptr<binding_t> parse_binding_from_json(const Json::Value& v
|
|||||||
#undef i3IPC_TYPE_STR
|
#undef i3IPC_TYPE_STR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<mode_t> parse_mode_from_json(const Json::Value& value) {
|
||||||
|
if (value.isNull())
|
||||||
|
return std::shared_ptr<mode_t>();
|
||||||
|
Json::Value change = value["change"];
|
||||||
|
Json::Value pango_markup = value["pango_markup"];
|
||||||
|
|
||||||
|
std::shared_ptr<mode_t> p (new mode_t());
|
||||||
|
p->change = change.asString();
|
||||||
|
p->pango_markup = pango_markup.asBool();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static std::shared_ptr<bar_config_t> parse_bar_config_from_json(const Json::Value& value) {
|
static std::shared_ptr<bar_config_t> parse_bar_config_from_json(const Json::Value& value) {
|
||||||
#define i3IPC_TYPE_STR "PARSE BAR CONFIG FROM JSON"
|
#define i3IPC_TYPE_STR "PARSE BAR CONFIG FROM JSON"
|
||||||
@@ -298,10 +310,14 @@ connection::connection(const std::string& socket_path) : m_main_socket(i3_conne
|
|||||||
I3IPC_DEBUG("OUTPUT")
|
I3IPC_DEBUG("OUTPUT")
|
||||||
signal_output_event.emit();
|
signal_output_event.emit();
|
||||||
break;
|
break;
|
||||||
case ET_MODE:
|
case ET_MODE: {
|
||||||
I3IPC_DEBUG("MODE")
|
I3IPC_DEBUG("MODE")
|
||||||
signal_mode_event.emit();
|
Json::Value root;
|
||||||
|
IPC_JSON_READ(root);
|
||||||
|
std::shared_ptr<mode_t> mode_data = parse_mode_from_json(root);
|
||||||
|
signal_mode_event.emit(*mode_data);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ET_WINDOW: {
|
case ET_WINDOW: {
|
||||||
window_event_t ev;
|
window_event_t ev;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
|
|||||||
Reference in New Issue
Block a user