| 2302 | } |
| 2303 | |
| 2304 | bool tabletToolAxisEvent(TabletToolAxisEvent *event) override |
| 2305 | { |
| 2306 | Window *window = input()->tablet()->focus(); |
| 2307 | if (!window || !window->surface()) { |
| 2308 | return false; |
| 2309 | } |
| 2310 | |
| 2311 | TabletSeatV2Interface *seat = waylandServer()->tabletManagerV2()->seat(waylandServer()->seat()); |
| 2312 | TabletToolV2Interface *tool = seat->tool(event->tool); |
| 2313 | TabletV2Interface *tablet = seat->tablet(event->device); |
| 2314 | |
| 2315 | const auto [surface, surfaceLocalPos] = window->surface()->mapToInputSurface(window->mapToLocal(event->position)); |
| 2316 | tool->setCurrentSurface(surface); |
| 2317 | |
| 2318 | if (!tool->isClientSupported() || !tablet->isSurfaceSupported(surface)) { |
| 2319 | return emulateTabletEvent(event); |
| 2320 | } |
| 2321 | |
| 2322 | tool->sendMotion(surfaceLocalPos); |
| 2323 | |
| 2324 | if (tool->hasCapability(TabletToolV2Interface::Pressure)) { |
| 2325 | tool->sendPressure(event->pressure); |
| 2326 | } |
| 2327 | if (tool->hasCapability(TabletToolV2Interface::Tilt)) { |
| 2328 | tool->sendTilt(event->xTilt, event->yTilt); |
| 2329 | } |
| 2330 | if (tool->hasCapability(TabletToolV2Interface::Rotation)) { |
| 2331 | tool->sendRotation(event->rotation); |
| 2332 | } |
| 2333 | if (tool->hasCapability(TabletToolV2Interface::Distance)) { |
| 2334 | tool->sendDistance(event->distance); |
| 2335 | } |
| 2336 | if (tool->hasCapability(TabletToolV2Interface::Slider)) { |
| 2337 | tool->sendSlider(event->sliderPosition); |
| 2338 | } |
| 2339 | |
| 2340 | tool->sendFrame(std::chrono::duration_cast<std::chrono::milliseconds>(event->timestamp).count()); |
| 2341 | return true; |
| 2342 | } |
| 2343 | |
| 2344 | bool tabletToolTipEvent(TabletToolTipEvent *event) override |
| 2345 | { |
nothing calls this directly
no test coverage detected