enum mouse_event mousebind_event_from_str(const char *str);
uint32_t mousebind_button_from_str(const char *str, uint32_t *modifiers);
struct mousebind *mousebind_create(const char *context);
+struct mousebind *mousebind_create_from(struct mousebind *from, const char *context);
#endif /* __LABWC_MOUSEBIND_H */
}
return m;
}
+
+struct mousebind *
+mousebind_create_from(struct mousebind *from, const char *context)
+{
+ if (!from) {
+ wlr_log(WLR_ERROR, "invalid mousebind instance specified");
+ return NULL;
+ }
+ struct mousebind *m = mousebind_create(context);
+ m->button = from->button;
+ m->modifiers = from->modifiers;
+ m->mouse_event = from->mouse_event;
+ return m;
+}
/*
* Example of what we are parsing:
* <mousebind button="Left" action="DoubleClick">
+ * <action name="Focus"/>
+ * <action name="Raise"/>
* <action name="ToggleMaximize"/>
* </mousebind>
*/
current_mousebind->mouse_event =
mousebind_event_from_str(content);
} else if (!strcmp(nodename, "name.action")) {
+ if (current_mousebind->action) {
+ current_mousebind = mousebind_create_from(current_mousebind,
+ current_mouse_context);
+ }
current_mousebind->action = strdup(content);
} else if (!strcmp(nodename, "command.action")) {
current_mousebind->command = strdup(content);