config: add tablet rotate configuration

Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
This commit is contained in:
Jens Peters 2023-12-29 22:36:06 +01:00 committed by Johan Malm
parent 20bba35570
commit 23ecc32562
5 changed files with 35 additions and 4 deletions

View file

@ -826,6 +826,8 @@ entry(xmlNode *node, char *nodename, char *content)
} else {
wlr_log(WLR_ERROR, "Invalid value for <resize popupShow />");
}
} else if (!strcasecmp(nodename, "rotate.tablet")) {
rc.tablet.rotation = tablet_parse_rotation(atoi(content));
} else if (!strcasecmp(nodename, "button.map.tablet")) {
button_map_from = tablet_button_from_str(content);
} else if (!strcasecmp(nodename, "to.map.tablet")) {

View file

@ -7,6 +7,24 @@
#include "config/tablet.h"
#include "config/rcxml.h"
enum rotation tablet_parse_rotation(int value)
{
switch (value) {
case 0:
return LAB_ROTATE_NONE;
case 90:
return LAB_ROTATE_90;
case 180:
return LAB_ROTATE_180;
case 270:
return LAB_ROTATE_270;
default:
wlr_log(WLR_ERROR, "Invalid value for tablet rotation: %d", value);
break;
}
return LAB_ROTATE_NONE;
}
uint32_t tablet_button_from_str(const char *button)
{
if (!strcasecmp(button, "Tip")) {