@@ -1357,16 +1357,75 @@ impl WindowsRecorder {
1357
1357
events_this_second : & Arc < Mutex < ( u32 , Instant ) > > ,
1358
1358
event : WorkflowEvent ,
1359
1359
) {
1360
- // No rate limiting or processing delays in simplified version
1360
+ // Apply rate limiting first
1361
+ if let Some ( max_events) = config. effective_max_events_per_second ( ) {
1362
+ let mut counter = events_this_second. lock ( ) . unwrap ( ) ;
1363
+ let now = Instant :: now ( ) ;
1364
+
1365
+ // Reset counter if a new second has started
1366
+ if now. duration_since ( counter. 1 ) . as_secs ( ) >= 1 {
1367
+ counter. 0 = 0 ;
1368
+ counter. 1 = now;
1369
+ }
1370
+
1371
+ if counter. 0 >= max_events {
1372
+ return ; // Rate limit exceeded
1373
+ }
1361
1374
1362
- // In simplified version, we don't filter mouse events but we do exclude mouse moves entirely
1375
+ counter. 0 += 1 ;
1376
+ }
1377
+
1378
+ // Apply processing delay
1379
+ let processing_delay = config. effective_processing_delay_ms ( ) ;
1380
+ if processing_delay > 0 {
1381
+ let mut last_time = last_event_time. lock ( ) . unwrap ( ) ;
1382
+ let now = Instant :: now ( ) ;
1383
+ if now. duration_since ( * last_time) . as_millis ( ) < processing_delay as u128 {
1384
+ return ; // Filter out if within delay window
1385
+ }
1386
+ * last_time = now;
1387
+ }
1388
+
1389
+ // Apply event-specific filtering
1363
1390
let should_filter = match & event {
1364
- // Filter out mouse move events entirely
1365
1391
WorkflowEvent :: Mouse ( mouse_event) => {
1366
- matches ! ( mouse_event. event_type, MouseEventType :: Move )
1392
+ if config. should_filter_mouse_noise ( ) {
1393
+ matches ! (
1394
+ mouse_event. event_type,
1395
+ MouseEventType :: Move | MouseEventType :: Wheel
1396
+ )
1397
+ } else {
1398
+ false
1399
+ }
1367
1400
}
1368
- // Don't filter other events
1369
- _ => false ,
1401
+ WorkflowEvent :: Keyboard ( keyboard_event) => {
1402
+ if config. should_filter_keyboard_noise ( ) {
1403
+ // Filter key-down events and non-printable keys
1404
+ if keyboard_event. is_key_down {
1405
+ // Keep printable characters (32-126) and common editing keys
1406
+ !( ( keyboard_event. key_code >= 32 && keyboard_event. key_code <= 126 )
1407
+ || matches ! (
1408
+ keyboard_event. key_code,
1409
+ 0x08 | // Backspace
1410
+ 0x2E | // Delete
1411
+ 0x20 | // Space
1412
+ 0x0D | // Enter
1413
+ 0x09 // Tab
1414
+ ) )
1415
+ } else {
1416
+ false
1417
+ }
1418
+ } else {
1419
+ false
1420
+ }
1421
+ }
1422
+ // Never filter high-value events
1423
+ WorkflowEvent :: ApplicationSwitch ( _)
1424
+ | WorkflowEvent :: Click ( _)
1425
+ | WorkflowEvent :: Clipboard ( _) => false ,
1426
+
1427
+ // Other events can be filtered in LowEnergy mode
1428
+ _ => matches ! ( config. performance_mode, crate :: PerformanceMode :: LowEnergy ) ,
1370
1429
} ;
1371
1430
1372
1431
if !should_filter {
@@ -1564,6 +1623,10 @@ impl WindowsRecorder {
1564
1623
trigger_reason : & str ,
1565
1624
config : & WorkflowRecorderConfig ,
1566
1625
) {
1626
+ if !config. record_text_input_completion {
1627
+ return ;
1628
+ }
1629
+
1567
1630
let mut tracker = match current_text_input. try_lock ( ) {
1568
1631
Ok ( guard) => guard,
1569
1632
Err ( _) => {
0 commit comments