</mouse>
<!--
+ The active tablet area can be specified by setting the top/left
+ coordinate (in mm) and/or width/height (in mm). If width or height
+ are omitted or default (0.0), width/height will be set to the
+ remaining width/height seen from top/left.
+
The tablet orientation can be changed in 90 degree steps, thus
- rotation can be set to [0|90|180|270].
+ rotation can be set to [0|90|180|270]. Rotation will be applied
+ after applying tablet area transformation.
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 rotate="0">
+ <!-- Active area dimensions are in mm -->
+ <area top="0.0" left="0.0" width="0.0" height="0.0">
<map button="tip" to="left" />
<map button="stylus" to="right" />
<map button="stylus2" to="middle" />
/* graphics tablet */
struct tablet_config {
+ struct wlr_fbox box;
enum rotation rotation;
uint16_t button_map_count;
struct button_map_entry button_map[BUTTON_MAP_MAX];
uint32_t to;
};
+double tablet_get_dbl_if_positive(const char *content, const char *name);
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);
} 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")) {
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;
#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)
{
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);