leejunyoung5819wayland-android-remote

공개

Ubuntu(Wayland/X11)에서 Android 기기 화면 미러링 및 원격 제어 (Rust)

마우스 오른쪽 클릭 = 즉시 길게 누르기

- TOUCH_EVENT 오프셋 2..4를 flags로: 0x0001 LONG_PRESS (DOWN에만 의미)
- 호스트: 오른쪽 버튼 누름을 길게 누르기 터치로 보내고, 같은 버튼을 뗄 때 UP
- 데몬: 누르는 동안만 long_press_timeout을 120ms로 줄였다가 떼면 복원
  (줄인 채 종료되면 다음 시작 때 복원), DEEP_PRESS 분류 MOVE도 함께 주입,
  짧게 떼도 길게 누르기가 되도록 UP을 미룸
- 실기기: 홈 화면 아이콘 메뉴 0.5초 -> 약 0.17초
- probe: --rclick
작성자
LeeJunyoung
작성 시각
커밋
fe8ddc3d747c10fcf8ae5df6272e86f18f87501c
부모
70804a9
이 시점의 파일 보기

변경된 파일 7개

+305-23
수정android/app/src/main/java/com/androidremote/daemon/DaemonMain.kt+1-0
@@ -42,6 +42,7 @@ object DaemonMain {
4242 }
4343
4444 val identity = DeviceIdentity.loadOrCreate(dataDir)
45추가: LongPress.recover(dataDir)
4546 val whitelist = Whitelist(File(dataDir, "whitelist"))
4647 Log.i("android-remote daemon v$DAEMON_VERSION uid=${android.os.Process.myUid()}")
4748 Log.i("인증서 SHA-256: ${Hex.encode(identity.fingerprint)}")
수정android/app/src/main/java/com/androidremote/daemon/InputInjector.kt+171-7
@@ -35,7 +35,57 @@ class InputInjector {
3535 return (x + 0.5f) * dw / fw to (y + 0.5f) * dh / fh
3636 }
3737
38삭제: fun touch(t: Messages.TouchEvent) {
38추가: /**
39추가: * 오른쪽 버튼 길게 누르기 (기획서 7.3 4항). 시작 시각과, 너무 일찍 뗐을 때 미뤄 둔 UP.
40추가: * 세게 누르기(DEEP_PRESS)를 모르는 앱도 길게 누르기로 판정하도록 UP을 길게 누르기 시간 뒤로 미룬다.
41추가: */
42추가: private var longPressAt = 0L
43추가: private var deferredUp: Messages.TouchEvent? = null
44추가: private val lock = Any()
45추가:
46추가: fun touch(t: Messages.TouchEvent) = synchronized(lock) {
47추가: // 미뤄 둔 UP이 있으면 다음 터치보다 먼저 보낸다.
48추가: deferredUp?.let { deferredUp = null; finishUp(it) }
49추가: if (t.action == TouchAction.UP && longPressAt != 0L && pointers.size == 1 && pointers[0].id == t.pointerId) {
50추가: val wait = longPressAt + LongPress.holdMs() - SystemClock.uptimeMillis()
51추가: if (wait > 0) {
52추가: // 너무 일찍 떼면 길게 누르기로 판정되기 전에 끝나므로 UP을 미룬다.
53추가: deferredUp = t
54추가: scheduler.schedule({
55추가: synchronized(lock) { if (deferredUp === t) { deferredUp = null; finishUp(t) } }
56추가: }, wait, java.util.concurrent.TimeUnit.MILLISECONDS)
57추가: } else {
58추가: finishUp(t)
59추가: }
60추가: return@synchronized
61추가: }
62추가: if (t.action == TouchAction.DOWN && t.longPress && pointers.isEmpty()) {
63추가: // 시스템 길게 누르기 시간을 잠깐 줄여 바로 길게 누르기가 되게 한다. 앱은 DOWN을 받을 때
64추가: // 이 값을 읽으므로 DOWN보다 먼저 바꾼다.
65추가: LongPress.shorten()
66추가: touchNow(t)
67추가: longPressAt = touchDownTime
68추가: // 세게 누르기(DEEP_PRESS)를 아는 View는 시간과 상관없이 바로 길게 누르기를 한다.
69추가: injectMotion(MotionEvent.ACTION_MOVE, SystemClock.uptimeMillis(), LongPress.CLASSIFICATION_DEEP_PRESS)
70추가: return@synchronized
71추가: }
72추가: touchNow(t)
73추가: if (pointers.isEmpty()) endLongPress()
74추가: }
75추가:
76추가: private fun finishUp(t: Messages.TouchEvent) {
77추가: touchNow(t)
78추가: if (pointers.isEmpty()) endLongPress()
79추가: }
80추가:
81추가: private fun endLongPress() {
82추가: if (longPressAt != 0L) {
83추가: longPressAt = 0L
84추가: LongPress.restore()
85추가: }
86추가: }
87추가:
88추가: private fun touchNow(t: Messages.TouchEvent) {
3989 val (x, y) = toDisplay(t.x, t.y, t.frameWidth, t.frameHeight)
4090 val now = SystemClock.uptimeMillis()
4191 val pressure = t.pressure / 65535f
@@ -76,7 +126,9 @@ class InputInjector {
76126 }
77127
78128 /** 연결이 끊길 때 눌린 채로 남은 터치를 정리한다. */
79삭제: fun releaseAll() {
129추가: fun releaseAll() = synchronized(lock) {
130추가: deferredUp = null
131추가: endLongPress()
80132 if (pointers.isNotEmpty()) {
81133 injectMotion(MotionEvent.ACTION_CANCEL, SystemClock.uptimeMillis())
82134 pointers.clear()
@@ -84,7 +136,7 @@ class InputInjector {
84136 for (keycode in keyDownTimes.keys.toList()) key(KeyAction.UP, keycode, 0, 0, 0)
85137 }
86138
87삭제: private fun injectMotion(action: Int, now: Long) {
139추가: private fun injectMotion(action: Int, now: Long, classification: Int = 0) {
88140 val props = Array(pointers.size) { i ->
89141 MotionEvent.PointerProperties().apply {
90142 id = pointers[i].id
@@ -99,14 +151,22 @@ class InputInjector {
99151 size = 1f
100152 }
101153 }
102삭제: val e = MotionEvent.obtain(
103삭제: touchDownTime, now, action, pointers.size, props, coords,
104삭제: 0, 0, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0,
105삭제: )
154추가: val e = LongPress.obtainClassified(touchDownTime, now, action, props, coords, classification)
155추가: ?: MotionEvent.obtain(
156추가: touchDownTime, now, action, pointers.size, props, coords,
157추가: 0, 0, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0,
158추가: )
106159 SystemAccess.injectEvent(e)
107160 e.recycle()
108161 }
109162
163추가: companion object {
164추가: /** 미룬 UP을 보내는 타이머. 데몬 전체에서 하나만 쓴다. */
165추가: private val scheduler = java.util.concurrent.Executors.newSingleThreadScheduledExecutor { r ->
166추가: Thread(r, "deferred-touch").apply { isDaemon = true }
167추가: }
168추가: }
169추가:
110170 fun scroll(s: Messages.ScrollEvent) {
111171 val (x, y) = toDisplay(s.x, s.y, s.frameWidth, s.frameHeight)
112172 val now = SystemClock.uptimeMillis()
@@ -180,3 +240,107 @@ class InputInjector {
180240 const val CLICK = 2
181241 }
182242}
243추가:
244추가: /**
245추가: * 즉시 길게 누르기. MotionEvent에 세게 누르기(CLASSIFICATION_DEEP_PRESS, Android 10+) 분류를 달려면
246추가: * 숨은 `MotionEvent.obtain(..., displayId, flags, classification)`을 써야 한다. 없으면 null을 돌려주고
247추가: * 호출 측은 분류 없는 이벤트를 쓴다(그래도 UP을 미뤄 길게 누르기는 된다).
248추가: */
249추가: object LongPress {
250추가: const val CLASSIFICATION_DEEP_PRESS = 2
251추가: /** 오른쪽 클릭 동안 쓰는 길게 누르기 시간. */
252추가: private const val SHORT_MS = 120L
253추가: private const val KEY = "long_press_timeout"
254추가:
255추가: /** 원래 값을 적어 두는 파일. 줄인 채로 데몬이 죽어도 다음 시작 때 되돌린다. */
256추가: private var marker: java.io.File? = null
257추가: /** 줄이기 전 값. 설정에 없었으면 "null". 줄여 둔 동안만 null이 아니다. */
258추가: private var original: String? = null
259추가:
260추가: /** 데몬 시작 시 호출. 지난번에 줄인 채로 끝났으면 원래 값으로 되돌린다. */
261추가: fun recover(dataDir: java.io.File) {
262추가: val f = java.io.File(dataDir, "long_press_timeout.orig")
263추가: marker = f
264추가: if (f.exists()) {
265추가: val v = f.readText().trim()
266추가: Log.i("길게 누르기 시간 복원: $v")
267추가: put(v)
268추가: f.delete()
269추가: }
270추가: }
271추가:
272추가: /** 원래 길게 누르기 시간 + 여유. 줄여 둔 동안은 짧은 값 기준. */
273추가: fun holdMs(): Long =
274추가: (if (original != null) SHORT_MS else (original ?: current()).toLongOrNull() ?: 500L) + 80
275추가:
276추가: @Synchronized
277추가: fun shorten() {
278추가: if (original != null) return
279추가: val cur = current()
280추가: runCatching { marker?.writeText(cur) }
281추가: original = cur
282추가: put(SHORT_MS.toString())
283추가: // 바뀐 값이 앱 프로세스에 전달될 시간을 준다.
284추가: Thread.sleep(40)
285추가: }
286추가:
287추가: @Synchronized
288추가: fun restore() {
289추가: val v = original ?: return
290추가: original = null
291추가: put(v)
292추가: runCatching { marker?.delete() }
293추가: }
294추가:
295추가: private fun current(): String = cmd("get", KEY).ifEmpty { "null" }
296추가:
297추가: private fun put(value: String) {
298추가: if (value == "null") cmd("delete", KEY) else cmd("put", KEY, value)
299추가: }
300추가:
301추가: /** `cmd settings`는 앱 프로세스를 띄우지 않아 `settings`보다 빠르다 (약 25ms). */
302추가: private fun cmd(vararg args: String): String = try {
303추가: val p = Runtime.getRuntime().exec(arrayOf("cmd", "settings", args[0], "secure", *args.drop(1).toTypedArray()))
304추가: val out = p.inputStream.bufferedReader().readText().trim()
305추가: p.waitFor()
306추가: out
307추가: } catch (e: Exception) {
308추가: Log.w("설정 명령 실패 (${args.joinToString(" ")}): $e")
309추가: ""
310추가: }
311추가:
312추가: private val obtain: java.lang.reflect.Method? by lazy {
313추가: try {
314추가: MotionEvent::class.java.getMethod(
315추가: "obtain",
316추가: Long::class.javaPrimitiveType, Long::class.javaPrimitiveType, Int::class.javaPrimitiveType,
317추가: Int::class.javaPrimitiveType, Array<MotionEvent.PointerProperties>::class.java,
318추가: Array<MotionEvent.PointerCoords>::class.java, Int::class.javaPrimitiveType,
319추가: Int::class.javaPrimitiveType, Float::class.javaPrimitiveType, Float::class.javaPrimitiveType,
320추가: Int::class.javaPrimitiveType, Int::class.javaPrimitiveType, Int::class.javaPrimitiveType,
321추가: Int::class.javaPrimitiveType, Int::class.javaPrimitiveType, Int::class.javaPrimitiveType,
322추가: )
323추가: } catch (e: Exception) {
324추가: Log.w("분류 지정 MotionEvent.obtain 없음, 즉시 길게 누르기는 시간 대기로 대신함: $e")
325추가: null
326추가: }
327추가: }
328추가:
329추가: fun obtainClassified(
330추가: downTime: Long, eventTime: Long, action: Int,
331추가: props: Array<MotionEvent.PointerProperties>, coords: Array<MotionEvent.PointerCoords>,
332추가: classification: Int,
333추가: ): MotionEvent? {
334추가: if (classification == 0) return null
335추가: val m = obtain ?: return null
336추가: return try {
337추가: m.invoke(
338추가: null, downTime, eventTime, action, props.size, props, coords,
339추가: 0, 0, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0, 0, classification,
340추가: ) as MotionEvent
341추가: } catch (e: Exception) {
342추가: Log.w("분류 지정 MotionEvent 생성 실패: ${e.cause ?: e}")
343추가: null
344추가: }
345추가: }
346추가: }
수정android/app/src/main/java/com/androidremote/daemon/Protocol.kt+4-2
@@ -206,9 +206,11 @@ object Messages {
206206 return p[0].toInt() and 0xFF
207207 }
208208
209추가: /** [longPress]: flags 0x0001. DOWN을 바로 길게 누르기로 처리한다 (마우스 오른쪽 버튼). */
209210 class TouchEvent(
210211 val action: Int, val pointerId: Int, val x: Int, val y: Int,
211212 val frameWidth: Int, val frameHeight: Int, val pressure: Int,
213추가: val longPress: Boolean = false,
212214 )
213215
214216 fun decodeTouchEvent(p: ByteArray): TouchEvent {
@@ -216,7 +218,7 @@ object Messages {
216218 val b = ByteBuffer.wrap(p)
217219 val action = b.get().toInt() and 0xFF
218220 val pointerId = b.get().toInt() and 0xFF
219삭제: b.short
221추가: val flags = b.short.toInt() and 0xFFFF
220222 val x = b.int
221223 val y = b.int
222224 val fw = b.short.toInt() and 0xFFFF
@@ -224,7 +226,7 @@ object Messages {
224226 val pressure = b.short.toInt() and 0xFFFF
225227 if (action > 3) throw ProtocolException("TOUCH_EVENT action 오류: $action")
226228 if (fw == 0 || fh == 0) throw ProtocolException("TOUCH_EVENT 프레임 크기 0")
227삭제: return TouchEvent(action, pointerId, x, y, fw, fh, pressure)
229추가: return TouchEvent(action, pointerId, x, y, fw, fh, pressure, flags and 0x0001 != 0)
228230 }
229231
230232 class ScrollEvent(val x: Int, val y: Int, val frameWidth: Int, val frameHeight: Int, val hScroll: Int, val vScroll: Int)
수정examples/probe.rs+14-1
@@ -5,7 +5,7 @@
55//! `--record`를 주면 영상 채널로 받은 Annex-B 스트림을 파일로 저장한다(ffprobe/ffplay로 확인).
66//!
77//! 입력 주입 점검(좌표는 영상 프레임 기준, 주어진 순서대로 실행):
8삭제: //! `--tap x,y`, `--swipe x1,y1,x2,y2`, `--scroll x,y,v120`, `--text 문자열`, `--keycode N`, `--wait ms`,
8추가: //! `--tap x,y`, `--rclick x,y`(오른쪽 클릭 = 즉시 길게 누르기), `--swipe x1,y1,x2,y2`, `--scroll x,y,v120`, `--text 문자열`, `--keycode N`, `--wait ms`,
99//! `--action back|home|recents|rotate|screenoff|screenon|copy|paste|selectall`,
1010//! `--clip 문자열`(호스트 클립보드로 보내고 붙여넣기), `--clip-image 파일.png|jpg`(이미지 클립보드),
1111//! `--clip-out 경로`(--listen 중 받은 클립보드 이미지를 저장), `--send-file 경로`(파일 전송), `--listen ms`(그동안 받은 제어 메시지 출력),
@@ -187,6 +187,7 @@ async fn run_input_ops(
187187 frame_width: fw,
188188 frame_height: fh,
189189 pressure: if action == TouchAction::Up { 0 } else { 0xFFFF },
190추가: long_press: false,
190191 })
191192 };
192193 let nums =
@@ -202,6 +203,18 @@ async fn run_input_ops(
202203 control.send(&touch(TouchAction::Up, v[0], v[1])).await?;
203204 println!("탭 {},{}", v[0], v[1]);
204205 }
206추가: "--rclick" => {
207추가: // 마우스 오른쪽 클릭: 길게 누르기 DOWN 뒤 바로 UP.
208추가: let v = nums(value);
209추가: let mut down = touch(TouchAction::Down, v[0], v[1]);
210추가: if let Message::TouchEvent(t) = &mut down {
211추가: t.long_press = true;
212추가: }
213추가: control.send(&down).await?;
214추가: tokio::time::sleep(Duration::from_millis(60)).await;
215추가: control.send(&touch(TouchAction::Up, v[0], v[1])).await?;
216추가: println!("오른쪽 클릭 {},{}", v[0], v[1]);
217추가: }
205218 "--swipe" => {
206219 let v = nums(value);
207220 control.send(&touch(TouchAction::Down, v[0], v[1])).await?;
수정src/protocol/messages.rs+13-2
@@ -753,16 +753,24 @@ pub struct TouchEvent {
753753 pub frame_width: u16,
754754 pub frame_height: u16,
755755 pub pressure: u16,
756추가: /// flags 0x0001: DOWN을 바로 길게 누르기로 처리한다 (마우스 오른쪽 버튼).
757추가: pub long_press: bool,
756758}
757759
758760impl TouchEvent {
759761 pub const LEN: usize = 20;
762추가: /// `flags` 비트: 길게 누르기.
763추가: pub const FLAG_LONG_PRESS: u16 = 0x0001;
760764
761765 pub fn encode(&self, dst: &mut BytesMut) {
762766 dst.reserve(Self::LEN);
763767 dst.put_u8(self.action.into());
764768 dst.put_u8(self.pointer_id);
765삭제: dst.put_bytes(0, 2);
769추가: dst.put_u16(if self.long_press {
770추가: Self::FLAG_LONG_PRESS
771추가: } else {
772추가: 0
773추가: });
766774 dst.put_u32(self.x);
767775 dst.put_u32(self.y);
768776 dst.put_u16(self.frame_width);
@@ -778,7 +786,7 @@ impl TouchEvent {
778786 let action =
779787 TouchAction::try_from(b.get_u8()).map_err(|_| invalid(T, "알 수 없는 action"))?;
780788 let pointer_id = b.get_u8();
781삭제: b.advance(2);
789추가: let flags = b.get_u16();
782790 Ok(Self {
783791 action,
784792 pointer_id,
@@ -787,6 +795,7 @@ impl TouchEvent {
787795 frame_width: b.get_u16(),
788796 frame_height: b.get_u16(),
789797 pressure: b.get_u16(),
798추가: long_press: flags & Self::FLAG_LONG_PRESS != 0,
790799 })
791800 }
792801}
@@ -1448,6 +1457,7 @@ mod tests {
14481457 frame_width: 1080,
14491458 frame_height: 2400,
14501459 pressure: 0xFFFF,
1460추가: long_press: false,
14511461 }),
14521462 Message::ScrollEvent(ScrollEvent {
14531463 x: 10,
@@ -1545,6 +1555,7 @@ mod tests {
15451555 frame_width: 0x090A,
15461556 frame_height: 0x0B0C,
15471557 pressure: 0x0D0E,
1558추가: long_press: false,
15481559 });
15491560 assert_eq!(
15501561 enc(&m),
수정src/ui/input.rs+88-5
@@ -49,6 +49,8 @@ impl VideoTarget {
4949/// 누르고 있는 터치 하나 (pointer_id 0).
5050#[derive(Debug, Clone, Copy)]
5151struct Touch {
52추가: /// 이 터치를 시작한 마우스 버튼. 같은 버튼을 떼야 끝난다.
53추가: button: PointerButton,
5254 /// 마지막으로 보낸 좌표.
5355 last: (u32, u32),
5456 /// 누를 때의 프레임 크기. 바뀌면 취소한다.
@@ -118,18 +120,21 @@ impl InputState {
118120 }
119121 }
120122 Event::PointerGone => self.pointer = None,
123추가: // 왼쪽 버튼은 터치, 오른쪽 버튼은 바로 길게 누르기(누른 채 움직이면 끌기).
121124 Event::PointerButton {
122125 pos,
123삭제: button: PointerButton::Primary,
126추가: button: button @ (PointerButton::Primary | PointerButton::Secondary),
124127 pressed,
125128 ..
126129 } => {
127130 self.pointer = Some(*pos);
128131 match (*pressed, target) {
129132 (true, Some(v)) if self.touch.is_none() && v.rect.contains(*pos) => {
130삭제: self.touch_down(v, *pos, out);
133추가: self.touch_down(v, *pos, *button, out);
134추가: }
135추가: (false, Some(v)) if self.touch.is_some_and(|t| t.button == *button) => {
136추가: self.touch_up(v, *pos, out)
131137 }
132삭제: (false, Some(v)) if self.touch.is_some() => self.touch_up(v, *pos, out),
133138 _ => {}
134139 }
135140 }
@@ -180,10 +185,21 @@ impl InputState {
180185 }
181186 }
182187
183삭제: fn touch_down(&mut self, v: VideoTarget, pos: Pos2, out: &mut Vec<Message>) {
188추가: fn touch_down(
189추가: &mut self,
190추가: v: VideoTarget,
191추가: pos: Pos2,
192추가: button: PointerButton,
193추가: out: &mut Vec<Message>,
194추가: ) {
184195 let last = v.to_frame(pos);
185삭제: out.push(touch_message(TouchAction::Down, last, (v.width, v.height)));
196추가: let mut msg = touch_message(TouchAction::Down, last, (v.width, v.height));
197추가: if let Message::TouchEvent(t) = &mut msg {
198추가: t.long_press = button == PointerButton::Secondary;
199추가: }
200추가: out.push(msg);
186201 self.touch = Some(Touch {
202추가: button,
187203 last,
188204 frame: (v.width, v.height),
189205 pending: None,
@@ -334,6 +350,7 @@ fn touch_message(action: TouchAction, (x, y): (u32, u32), frame: (u16, u16)) ->
334350 TouchAction::Down | TouchAction::Move => FULL_PRESSURE,
335351 TouchAction::Up | TouchAction::Cancel => 0,
336352 },
353추가: long_press: false,
337354 })
338355}
339356
@@ -482,6 +499,72 @@ mod tests {
482499 ));
483500 }
484501
502추가: #[test]
503추가: fn right_button_is_immediate_long_press_until_released() {
504추가: let v = target();
505추가: let mut s = InputState::default();
506추가: let mut out = Vec::new();
507추가: let btn = |button, pressed| Event::PointerButton {
508추가: pos: v.rect.center(),
509추가: button,
510추가: pressed,
511추가: modifiers: Modifiers::NONE,
512추가: };
513추가: s.process(
514추가: &[btn(PointerButton::Secondary, true)],
515추가: true,
516추가: Some(v),
517추가: &mut out,
518추가: );
519추가: assert!(matches!(
520추가: out.as_slice(),
521추가: [Message::TouchEvent(TouchEvent {
522추가: action: TouchAction::Down,
523추가: long_press: true,
524추가: ..
525추가: })]
526추가: ));
527추가: out.clear();
528추가: // 오른쪽으로 누른 터치는 왼쪽 버튼을 떼도 끝나지 않는다.
529추가: s.process(
530추가: &[btn(PointerButton::Primary, false)],
531추가: true,
532추가: Some(v),
533추가: &mut out,
534추가: );
535추가: assert!(out.is_empty());
536추가: s.process(
537추가: &[btn(PointerButton::Secondary, false)],
538추가: true,
539추가: Some(v),
540추가: &mut out,
541추가: );
542추가: assert!(matches!(
543추가: out.as_slice(),
544추가: [Message::TouchEvent(TouchEvent {
545추가: action: TouchAction::Up,
546추가: long_press: false,
547추가: ..
548추가: })]
549추가: ));
550추가: out.clear();
551추가: // 왼쪽 버튼 터치는 일반 터치다.
552추가: s.process(
553추가: &[btn(PointerButton::Primary, true)],
554추가: true,
555추가: Some(v),
556추가: &mut out,
557추가: );
558추가: assert!(matches!(
559추가: out.as_slice(),
560추가: [Message::TouchEvent(TouchEvent {
561추가: action: TouchAction::Down,
562추가: long_press: false,
563추가: ..
564추가: })]
565추가: ));
566추가: }
567추가:
485568 #[test]
486569 fn lost_target_cancels_touch() {
487570 let v = target();
수정src/ui/interaction_tests.rs+14-6
@@ -404,20 +404,28 @@ fn press_outside_video_sends_no_touch() {
404404}
405405
406406#[test]
407삭제: fn right_and_middle_click_send_nothing() {
407추가: fn middle_and_forward_click_send_nothing() {
408408 let mut h = harness_with_video();
409409 let l = layout_of(&h);
410삭제: for button in [
411삭제: egui::PointerButton::Secondary,
412삭제: egui::PointerButton::Middle,
413삭제: egui::PointerButton::Extra2,
414삭제: ] {
410추가: for button in [egui::PointerButton::Middle, egui::PointerButton::Extra2] {
415411 side_button(&mut h, l.viewport.center(), button);
416412 }
417413 assert!(h.state().rec.input.is_empty(), "{:?}", h.state().rec.input);
418414 assert_eq!(h.state().rec.system, None);
419415}
420416
417추가: #[test]
418추가: fn right_click_on_video_sends_long_press_touch() {
419추가: let mut h = harness_with_video();
420추가: let l = layout_of(&h);
421추가: side_button(&mut h, l.viewport.center(), egui::PointerButton::Secondary);
422추가: let t = touches(&h);
423추가: assert_eq!(t.len(), 2, "{t:?}");
424추가: assert!(t[0].long_press && t[0].action == TouchAction::Down);
425추가: assert!(!t[1].long_press && t[1].action == TouchAction::Up);
426추가: assert_eq!(h.state().rec.system, None);
427추가: }
428추가:
421429#[test]
422430fn wheel_up_scrolls_positive() {
423431 let mut h = harness_with_video();