First implemenation of <mouse> in rc.xml

Can successfully parse the following XML and and implement the action:

<mouse>
    <context name="TitleBar">
        <mousebind button="Left" action="DoubleClick">
            <action name="ToggleMaximize"/>
        </mousebind>
    </context>
</mouse>

The XML parsing code for this looks A LOT different than the already
existing XML parsing code. It may have to be reworked
This commit is contained in:
alex 2021-08-29 14:22:49 -04:00 committed by Johan Malm
parent 75564d6b8d
commit dfdb4e4b0e
6 changed files with 335 additions and 1 deletions

View file

@ -0,0 +1,41 @@
#ifndef __LABWC_MOUSEBIND_H
#define __LABWC_MOUSEBIND_H
#include <wayland-util.h>
enum mouse_context {
MOUSE_CONTEXT_TITLEBAR,
MOUSE_CONTEXT_NONE
};
enum mouse_button {
/*
* These values match the values returned by button event->button and were
* obtained experimentally
*/
MOUSE_BUTTON_LEFT = 272,
MOUSE_BUTTON_RIGHT = 273,
MOUSE_BUTTON_MIDDLE = 274,
MOUSE_BUTTON_NONE = -1
};
enum action_mouse_did {
MOUSE_ACTION_DOUBLECLICK,
MOUSE_ACTION_NONE
};
struct mousebind {
enum mouse_context context; /* ex: titlebar */
enum mouse_button button; /* ex: left, right, middle */
enum action_mouse_did mouse_action; /* ex: doubleclick, press, drag, etc */
const char* action; /* what to do because mouse did previous action */
const char* command;
struct wl_list link;
};
struct mousebind*
mousebind_create(const char* context_str, const char* mouse_button_str,
const char* action_mouse_did_str, const char* action,
const char* command);
#endif /* __LABWC_MOUSEBIND_H */