From 48c5a897129f37f5d58a6d560ae738c96dcc858d Mon Sep 17 00:00:00 2001 From: "Pedro M. de Echanove Pasquin" Date: Mon, 1 Jun 2026 00:19:49 +0200 Subject: [PATCH] =?UTF-8?q?touch:=20treat=20a=20compositor=20re-grab=20`do?= =?UTF-8?q?wn`=20as=20a=20drag=20continuation=20When=20the=20surface=20tha?= =?UTF-8?q?t=20owns=20a=20touch=20drag=20is=20destroyed=20mid-gesture,=20t?= =?UTF-8?q?he=20compositor=20re-opens=20the=20touch=20grab=20by=20issuing?= =?UTF-8?q?=20a=20fresh=20`down`=20on=20the=20surface=20now=20under=20the?= =?UTF-8?q?=20finger=20(smithay=20pins=20touch=20focus=20at=20`down`=20and?= =?UTF-8?q?=20won't=20re-target=20on=20motion).=20That=20`down`=20arrives?= =?UTF-8?q?=20for=20a=20slot=20the=20main=20surface=20already=20holds=20as?= =?UTF-8?q?=20its=20primary,=20with=20the=20drag=20state=20already=20migra?= =?UTF-8?q?ted=20here.=20Handling=20it=20through=20the=20normal=20`down`?= =?UTF-8?q?=20path=20would=20either=20restart=20the=20gesture=20or,=20sinc?= =?UTF-8?q?e=20the=20slot=20is=20taken,=20demote=20it=20to=20an=20auxiliar?= =?UTF-8?q?y=20touch=20=E2=80=94=20both=20abandon=20the=20in-flight=20drag?= =?UTF-8?q?.=20`TouchHandler::down`=20now=20early-returns=20when=20the=20f?= =?UTF-8?q?ocused=20surface's=20`primary=5Ftouch=5Fid`=20already=20equals?= =?UTF-8?q?=20the=20incoming=20slot,=20so=20the=20redundant=20`down`=20is?= =?UTF-8?q?=20a=20no-op=20and=20the=20following=20motion/up=20keep=20drivi?= =?UTF-8?q?ng=20the=20migrated=20drag.=20Completes=20the=20cross-surface?= =?UTF-8?q?=20drag=20fix=20whose=20other=20half=20(migrating=20`primary=5F?= =?UTF-8?q?touch=5Fid`=20on=20overlay=20teardown)=20already=20landed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/input/touch/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/input/touch/mod.rs b/src/input/touch/mod.rs index 0360263..f64781f 100644 --- a/src/input/touch/mod.rs +++ b/src/input/touch/mod.rs @@ -58,6 +58,14 @@ impl TouchHandler for AppData let pos = self.surface( focus ).to_physical( position.0, position.1 ); self.pointer_pos = pos; + // Compositor re-grab after the origin surface died mid-drag: this + // slot is already our primary and the drag state was migrated here, + // so treat the redundant `down` as a continuation, not a restart. + if self.surface( focus ).primary_touch_id == Some( id ) + { + return; + } + // Auxiliary slot path: a second (or third…) finger arriving // while another finger already drives the primary slot stays // out of the single-slot gesture machine entirely. The app