Add comments for missing tablet tool entries

And stop using default cases, so that we know which parts of the code
need an update when adding a new enum entry.

Closes: https://github.com/swaywm/wlroots/issues/2208
This commit is contained in:
Simon Ser 2020-05-28 12:54:17 +02:00 committed by Drew DeVault
parent 5e0ef70cc0
commit 1a23c1425f
2 changed files with 9 additions and 5 deletions

View File

@ -481,8 +481,10 @@ static enum wlr_tablet_tool_type tablet_type_to_wlr_type(enum zwp_tablet_tool_v2
return WLR_TABLET_TOOL_TYPE_MOUSE; return WLR_TABLET_TOOL_TYPE_MOUSE;
case ZWP_TABLET_TOOL_V2_TYPE_LENS: case ZWP_TABLET_TOOL_V2_TYPE_LENS:
return WLR_TABLET_TOOL_TYPE_LENS; return WLR_TABLET_TOOL_TYPE_LENS;
default: case ZWP_TABLET_TOOL_V2_TYPE_FINGER:
break; // unused, see:
// https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/18
abort();
} }
abort(); // unreachable abort(); // unreachable
} }

View File

@ -73,10 +73,12 @@ static enum zwp_tablet_tool_v2_type tablet_type_from_wlr_type(
return ZWP_TABLET_TOOL_V2_TYPE_MOUSE; return ZWP_TABLET_TOOL_V2_TYPE_MOUSE;
case WLR_TABLET_TOOL_TYPE_LENS: case WLR_TABLET_TOOL_TYPE_LENS:
return ZWP_TABLET_TOOL_V2_TYPE_LENS; return ZWP_TABLET_TOOL_V2_TYPE_LENS;
default: case WLR_TABLET_TOOL_TYPE_TOTEM:
/* We skip these devices earlier on */ // missing, see:
abort(); // unreachable // https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/19
abort();
} }
abort(); // unreachable
} }
void destroy_tablet_tool_v2(struct wl_resource *resource) { void destroy_tablet_tool_v2(struct wl_resource *resource) {