mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
config: parse multiple touch configurations
Also temporary disable touch output mapping. Will be restored later.
This commit is contained in:
parent
9d64b56367
commit
2c3ab16f39
3 changed files with 40 additions and 9 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
#include "common/border.h"
|
#include "common/border.h"
|
||||||
#include "common/buf.h"
|
#include "common/buf.h"
|
||||||
#include "common/font.h"
|
#include "common/font.h"
|
||||||
|
#include "config/touch.h"
|
||||||
#include "config/tablet.h"
|
#include "config/tablet.h"
|
||||||
#include "config/libinput.h"
|
#include "config/libinput.h"
|
||||||
#include "resize_indicator.h"
|
#include "resize_indicator.h"
|
||||||
|
|
@ -92,9 +93,7 @@ struct rcxml {
|
||||||
double scroll_factor;
|
double scroll_factor;
|
||||||
|
|
||||||
/* touch tablet */
|
/* touch tablet */
|
||||||
struct touch_config {
|
struct wl_list touch_configs;
|
||||||
char *output_name;
|
|
||||||
} touch;
|
|
||||||
|
|
||||||
/* graphics tablet */
|
/* graphics tablet */
|
||||||
struct tablet_config {
|
struct tablet_config {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ static bool in_regions;
|
||||||
static bool in_usable_area_override;
|
static bool in_usable_area_override;
|
||||||
static bool in_keybind;
|
static bool in_keybind;
|
||||||
static bool in_mousebind;
|
static bool in_mousebind;
|
||||||
|
static bool in_touch;
|
||||||
static bool in_libinput_category;
|
static bool in_libinput_category;
|
||||||
static bool in_window_switcher_field;
|
static bool in_window_switcher_field;
|
||||||
static bool in_window_rules;
|
static bool in_window_rules;
|
||||||
|
|
@ -46,6 +47,7 @@ static bool in_action_else_branch;
|
||||||
static struct usable_area_override *current_usable_area_override;
|
static struct usable_area_override *current_usable_area_override;
|
||||||
static struct keybind *current_keybind;
|
static struct keybind *current_keybind;
|
||||||
static struct mousebind *current_mousebind;
|
static struct mousebind *current_mousebind;
|
||||||
|
static struct touch_config_entry *current_touch;
|
||||||
static struct libinput_category *current_libinput_category;
|
static struct libinput_category *current_libinput_category;
|
||||||
static const char *current_mouse_context;
|
static const char *current_mouse_context;
|
||||||
static struct action *current_keybind_action;
|
static struct action *current_keybind_action;
|
||||||
|
|
@ -428,6 +430,22 @@ fill_mousebind(char *nodename, char *content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_touch(char *nodename, char *content)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(nodename, "touch")) {
|
||||||
|
current_touch = znew(*current_touch);
|
||||||
|
wl_list_append(&rc.touch_configs, ¤t_touch->link);
|
||||||
|
} else if (!strcasecmp(nodename, "deviceName.touch")) {
|
||||||
|
current_touch->device_name = xstrdup(content);
|
||||||
|
} else if (!strcasecmp(nodename, "mapToOutput.touch")) {
|
||||||
|
current_touch->output_name = xstrdup(content);
|
||||||
|
} else {
|
||||||
|
wlr_log(WLR_ERROR, "Unexpected data in touch parser: %s=\"%s\"",
|
||||||
|
nodename, content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_accel_profile(const char *s)
|
get_accel_profile(const char *s)
|
||||||
{
|
{
|
||||||
|
|
@ -687,6 +705,10 @@ entry(xmlNode *node, char *nodename, char *content)
|
||||||
fill_mousebind(nodename, content);
|
fill_mousebind(nodename, content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (in_touch) {
|
||||||
|
fill_touch(nodename, content);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (in_libinput_category) {
|
if (in_libinput_category) {
|
||||||
fill_libinput_category(nodename, content);
|
fill_libinput_category(nodename, content);
|
||||||
return;
|
return;
|
||||||
|
|
@ -866,8 +888,6 @@ entry(xmlNode *node, char *nodename, char *content)
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "Invalid value for <resize popupShow />");
|
wlr_log(WLR_ERROR, "Invalid value for <resize popupShow />");
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(nodename, "mapToOutput.touch")) {
|
|
||||||
rc.touch.output_name = xstrdup(content);
|
|
||||||
} else if (!strcasecmp(nodename, "mapToOutput.tablet")) {
|
} else if (!strcasecmp(nodename, "mapToOutput.tablet")) {
|
||||||
rc.tablet.output_name = xstrdup(content);
|
rc.tablet.output_name = xstrdup(content);
|
||||||
} else if (!strcasecmp(nodename, "rotate.tablet")) {
|
} else if (!strcasecmp(nodename, "rotate.tablet")) {
|
||||||
|
|
@ -948,6 +968,12 @@ xml_tree_walk(xmlNode *node)
|
||||||
in_mousebind = false;
|
in_mousebind = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcasecmp((char *)n->name, "touch")) {
|
||||||
|
in_touch = true;
|
||||||
|
traverse(n);
|
||||||
|
in_touch = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcasecmp((char *)n->name, "device")) {
|
if (!strcasecmp((char *)n->name, "device")) {
|
||||||
in_libinput_category = true;
|
in_libinput_category = true;
|
||||||
traverse(n);
|
traverse(n);
|
||||||
|
|
@ -1030,6 +1056,7 @@ rcxml_init(void)
|
||||||
wl_list_init(&rc.regions);
|
wl_list_init(&rc.regions);
|
||||||
wl_list_init(&rc.window_switcher.fields);
|
wl_list_init(&rc.window_switcher.fields);
|
||||||
wl_list_init(&rc.window_rules);
|
wl_list_init(&rc.window_rules);
|
||||||
|
wl_list_init(&rc.touch_configs);
|
||||||
}
|
}
|
||||||
has_run = true;
|
has_run = true;
|
||||||
|
|
||||||
|
|
@ -1051,8 +1078,6 @@ rcxml_init(void)
|
||||||
rc.doubleclick_time = 500;
|
rc.doubleclick_time = 500;
|
||||||
rc.scroll_factor = 1.0;
|
rc.scroll_factor = 1.0;
|
||||||
|
|
||||||
rc.touch.output_name = NULL;
|
|
||||||
|
|
||||||
rc.tablet.output_name = NULL;
|
rc.tablet.output_name = NULL;
|
||||||
rc.tablet.rotation = 0;
|
rc.tablet.rotation = 0;
|
||||||
rc.tablet.box = (struct wlr_fbox){0};
|
rc.tablet.box = (struct wlr_fbox){0};
|
||||||
|
|
@ -1574,7 +1599,13 @@ rcxml_finish(void)
|
||||||
zfree(m);
|
zfree(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
zfree(rc.touch.output_name);
|
struct touch_config_entry *touch_config, *touch_config_tmp;
|
||||||
|
wl_list_for_each_safe(touch_config, touch_config_tmp, &rc.touch_configs, link) {
|
||||||
|
wl_list_remove(&touch_config->link);
|
||||||
|
zfree(touch_config->device_name);
|
||||||
|
zfree(touch_config->output_name);
|
||||||
|
zfree(touch_config);
|
||||||
|
}
|
||||||
|
|
||||||
zfree(rc.tablet.output_name);
|
zfree(rc.tablet.output_name);
|
||||||
|
|
||||||
|
|
@ -1609,6 +1640,7 @@ rcxml_finish(void)
|
||||||
current_usable_area_override = NULL;
|
current_usable_area_override = NULL;
|
||||||
current_keybind = NULL;
|
current_keybind = NULL;
|
||||||
current_mousebind = NULL;
|
current_mousebind = NULL;
|
||||||
|
current_touch = NULL;
|
||||||
current_libinput_category = NULL;
|
current_libinput_category = NULL;
|
||||||
current_mouse_context = NULL;
|
current_mouse_context = NULL;
|
||||||
current_keybind_action = NULL;
|
current_keybind_action = NULL;
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ static void
|
||||||
map_touch_to_output(struct seat *seat, struct wlr_input_device *dev)
|
map_touch_to_output(struct seat *seat, struct wlr_input_device *dev)
|
||||||
{
|
{
|
||||||
struct wlr_touch *touch = wlr_touch_from_input_device(dev);
|
struct wlr_touch *touch = wlr_touch_from_input_device(dev);
|
||||||
char *output_name = touch->output_name ? touch->output_name : rc.touch.output_name;
|
char *output_name = touch->output_name ? touch->output_name : NULL;
|
||||||
wlr_log(WLR_INFO, "map touch to output %s\n", output_name);
|
wlr_log(WLR_INFO, "map touch to output %s\n", output_name);
|
||||||
map_input_to_output(seat, dev, output_name);
|
map_input_to_output(seat, dev, output_name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue