</mouse>
<!--
- Tablet buttons emulate regular mouse buttons.
+ The tablet orientation can be changed in 90 degree steps, thus
+ rotation can be set to [0|90|180|270].
- The tablet *button* can be set to any of [tip|stylus|stylus2|stylus3].
- Valid *to* mouse buttons are [left|right|middle].
+ Tablet buttons emulate regular mouse buttons. The tablet *button* can
+ be set to any of [tip|stylus|stylus2|stylus3]. Valid *to* mouse buttons
+ are [left|right|middle].
-->
- <tablet>
+ <tablet rotate="0">
<map button="tip" to="left" />
<map button="stylus" to="right" />
<map button="stylus2" to="middle" />
/* graphics tablet */
struct tablet_config {
+ enum rotation rotation;
uint16_t button_map_count;
struct button_map_entry button_map[BUTTON_MAP_MAX];
} tablet;
#include <stdint.h>
+enum rotation {
+ LAB_ROTATE_NONE = 0,
+ LAB_ROTATE_90,
+ LAB_ROTATE_180,
+ LAB_ROTATE_270,
+};
+
#define BUTTON_MAP_MAX 16
struct button_map_entry {
uint32_t from;
uint32_t to;
};
+enum rotation tablet_parse_rotation(int value);
uint32_t tablet_button_from_str(const char *button);
uint32_t mouse_button_from_str(const char *button);
void tablet_button_mapping_add(uint32_t from, uint32_t to);
} 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")) {
#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")) {