@@ -115,9 +115,9 @@ fn main() {
115115 let gui = settings. gui . clone ( ) ;
116116
117117 let event_handler = std:: thread:: spawn ( move || {
118- // 新增:右键触发长截图的节流配置
119- let debounce = Duration :: from_millis ( 800 ) ;
120- let mut last_right_long = Instant :: now ( ) - Duration :: from_secs ( 10 ) ;
118+ let debounce = Duration :: from_secs ( 1 ) ;
119+ // 确保第一次右键不会被当成抖动忽略
120+ let mut last_right_long = Instant :: now ( ) - debounce ;
121121
122122 while let Ok ( event) = event_receiver. recv ( ) {
123123 // 检查程序是否应该退出
@@ -138,7 +138,12 @@ fn main() {
138138 save_path_get ( & save_path) ,
139139 ]
140140 . to_vec ( ) ;
141- operate_exe ( & exe_path, args, gui_clone. clone ( ) ) ;
141+ // 放到后台线程,避免阻塞事件处理
142+ let exe_path_clone = exe_path. clone ( ) ;
143+ let gui_for_thread = gui_clone. clone ( ) ;
144+ std:: thread:: spawn ( move || {
145+ operate_exe ( & exe_path_clone, args, gui_for_thread) ;
146+ } ) ;
142147 }
143148 }
144149 // 单击事件处理
@@ -167,9 +172,14 @@ fn main() {
167172 save_path_get ( & save_path) ,
168173 ]
169174 . to_vec ( ) ;
170- operate_exe ( & exe_path, args, gui_clone. clone ( ) ) ;
175+ // 放到后台线程,避免阻塞导致“抖动事件”延迟处理而误通过
176+ let exe_path_clone = exe_path. clone ( ) ;
177+ let gui_for_thread = gui_clone. clone ( ) ;
178+ std:: thread:: spawn ( move || {
179+ operate_exe ( & exe_path_clone, args, gui_for_thread) ;
180+ } ) ;
171181 } else {
172- // 忽略抖动/快速重复点击
182+ // 忽略抖动
173183 }
174184 }
175185 }
0 commit comments