mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
config: add tablet area configuration
This commit is contained in:
parent
dd91cd89ae
commit
f0abd9304f
5 changed files with 32 additions and 2 deletions
|
|
@ -854,6 +854,14 @@ entry(xmlNode *node, char *nodename, char *content)
|
|||
} else {
|
||||
wlr_log(WLR_ERROR, "Invalid value for <resize popupShow />");
|
||||
}
|
||||
} else if (!strcasecmp(nodename, "left.area.tablet")) {
|
||||
rc.tablet.box.x = tablet_get_dbl_if_positive(content, "left");
|
||||
} else if (!strcasecmp(nodename, "top.area.tablet")) {
|
||||
rc.tablet.box.y = tablet_get_dbl_if_positive(content, "top");
|
||||
} else if (!strcasecmp(nodename, "width.area.tablet")) {
|
||||
rc.tablet.box.width = tablet_get_dbl_if_positive(content, "width");
|
||||
} else if (!strcasecmp(nodename, "height.area.tablet")) {
|
||||
rc.tablet.box.height = tablet_get_dbl_if_positive(content, "height");
|
||||
} else if (!strcasecmp(nodename, "rotate.tablet")) {
|
||||
rc.tablet.rotation = tablet_parse_rotation(atoi(content));
|
||||
} else if (!strcasecmp(nodename, "button.map.tablet")) {
|
||||
|
|
@ -1027,7 +1035,7 @@ rcxml_init(void)
|
|||
rc.doubleclick_time = 500;
|
||||
rc.scroll_factor = 1.0;
|
||||
|
||||
rc.tablet.button_map_count = 0;
|
||||
rc.tablet.box = (struct wlr_fbox){0};
|
||||
tablet_load_default_button_mappings();
|
||||
|
||||
rc.repeat_rate = 25;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,17 @@
|
|||
#include "config/tablet.h"
|
||||
#include "config/rcxml.h"
|
||||
|
||||
double
|
||||
tablet_get_dbl_if_positive(const char *content, const char *name)
|
||||
{
|
||||
double value = atof(content);
|
||||
if (value < 0) {
|
||||
wlr_log(WLR_ERROR, "Invalid value for tablet area %s", name);
|
||||
return 0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
enum rotation
|
||||
tablet_parse_rotation(int value)
|
||||
{
|
||||
|
|
@ -84,6 +95,7 @@ tablet_button_mapping_add(uint32_t from, uint32_t to)
|
|||
void
|
||||
tablet_load_default_button_mappings(void)
|
||||
{
|
||||
rc.tablet.button_map_count = 0;
|
||||
tablet_button_mapping_add(BTN_TOOL_PEN, BTN_LEFT); /* Used for the pen tip */
|
||||
tablet_button_mapping_add(BTN_STYLUS, BTN_RIGHT);
|
||||
tablet_button_mapping_add(BTN_STYLUS2, BTN_MIDDLE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue