| 2260 | } |
| 2261 | |
| 2262 | bool tabletToolProximityEvent(TabletToolProximityEvent *event) override |
| 2263 | { |
| 2264 | Window *window = input()->tablet()->focus(); |
| 2265 | if (!window || !window->surface()) { |
| 2266 | return false; |
| 2267 | } |
| 2268 | |
| 2269 | TabletSeatV2Interface *seat = waylandServer()->tabletManagerV2()->seat(waylandServer()->seat()); |
| 2270 | TabletToolV2Interface *tool = seat->tool(event->tool); |
| 2271 | TabletV2Interface *tablet = seat->tablet(event->device); |
| 2272 | |
| 2273 | const auto [surface, surfaceLocalPos] = window->surface()->mapToInputSurface(window->mapToLocal(event->position)); |
| 2274 | tool->setCurrentSurface(surface); |
| 2275 | |
| 2276 | if (!tool->isClientSupported() || !tablet->isSurfaceSupported(surface)) { |
| 2277 | return emulateTabletEvent(event); |
| 2278 | } |
| 2279 | |
| 2280 | if (event->type == TabletToolProximityEvent::EnterProximity) { |
| 2281 | tool->sendProximityIn(tablet); |
| 2282 | tool->sendMotion(surfaceLocalPos); |
| 2283 | } else { |
| 2284 | tool->sendProximityOut(); |
| 2285 | } |
| 2286 | |
| 2287 | if (tool->hasCapability(TabletToolV2Interface::Tilt)) { |
| 2288 | tool->sendTilt(event->xTilt, event->yTilt); |
| 2289 | } |
| 2290 | if (tool->hasCapability(TabletToolV2Interface::Rotation)) { |
| 2291 | tool->sendRotation(event->rotation); |
| 2292 | } |
| 2293 | if (tool->hasCapability(TabletToolV2Interface::Distance)) { |
| 2294 | tool->sendDistance(event->distance); |
| 2295 | } |
| 2296 | if (tool->hasCapability(TabletToolV2Interface::Slider)) { |
| 2297 | tool->sendSlider(event->sliderPosition); |
| 2298 | } |
| 2299 | |
| 2300 | tool->sendFrame(std::chrono::duration_cast<std::chrono::milliseconds>(event->timestamp).count()); |
| 2301 | return true; |
| 2302 | } |
| 2303 | |
| 2304 | bool tabletToolAxisEvent(TabletToolAxisEvent *event) override |
| 2305 | { |
nothing calls this directly
no test coverage detected