Skip to content

Commit

Permalink
tablet: add a helper function to get the current tool
Browse files Browse the repository at this point in the history
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Oct 31, 2019
1 parent 12021c8 commit bc461b0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/evdev-tablet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,18 @@ tablet_update_tool_state(struct tablet_dispatch *tablet,

}

static struct libinput_tablet_tool *
tablet_get_current_tool(struct tablet_dispatch *tablet)
{
if (tablet->current_tool.type == LIBINPUT_TOOL_NONE)
return NULL;

return tablet_get_tool(tablet,
tablet->current_tool.type,
tablet->current_tool.id,
tablet->current_tool.serial);
}

static void
tablet_flush(struct tablet_dispatch *tablet,
struct evdev_device *device,
Expand All @@ -1816,14 +1828,8 @@ tablet_flush(struct tablet_dispatch *tablet,
struct libinput_tablet_tool *tool;

tablet_update_tool_state(tablet, device, time);
if (tablet->current_tool.type == LIBINPUT_TOOL_NONE)
return;

tool = tablet_get_tool(tablet,
tablet->current_tool.type,
tablet->current_tool.id,
tablet->current_tool.serial);

tool = tablet_get_current_tool(tablet);
if (!tool)
return; /* OOM */

Expand Down

0 comments on commit bc461b0

Please sign in to comment.