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

@ -5,6 +5,7 @@
#include "labwc.h"
#include "menu/menu.h"
#include "ssd.h"
#include "config/mousebind.h"
#include <wlr/types/wlr_primary_selection.h>
static void
@ -343,7 +344,14 @@ cursor_button(struct wl_listener *listener, void *data)
damage_all_outputs(server);
if (is_double_click(500) && view_area == LAB_SSD_PART_TITLEBAR) {
view_toggle_maximize(view);
struct mousebind* mousebind;
wl_list_for_each_reverse(mousebind, &rc.mousebinds, link) {
if( (mousebind->context == MOUSE_CONTEXT_TITLEBAR) &&
(mousebind->mouse_action == MOUSE_ACTION_DOUBLECLICK) &&
(mousebind->button == (enum mouse_button)event->button) ) {
action(server, mousebind->action, mousebind->command);
}
}
return;
}