@@ -143,7 +143,6 @@ pub fn threadEnter(
143
143
.read_thread_pipe = pipe [1 ],
144
144
.read_thread_fd = pty_fds .read ,
145
145
.termios_timer = termios_timer ,
146
- .renderer_wakeup = io .renderer_wakeup ,
147
146
} };
148
147
149
148
// Start our process watcher
@@ -460,24 +459,31 @@ fn termiosTimer(
460
459
};
461
460
462
461
// If the mode changed, then we process it.
463
- if (! std .meta .eql (mode , exec .termios_mode )) {
462
+ if (! std .meta .eql (mode , exec .termios_mode )) mode_change : {
464
463
log .debug ("termios change mode={}" , .{mode });
465
464
exec .termios_mode = mode ;
466
465
466
+ // We assume we're in some sort of password input if we're
467
+ // in canonical mode and not echoing. This is a heuristic.
468
+ const password_input = mode .canonical and ! mode .echo ;
469
+
470
+ // If our password input state changed on the terminal then
471
+ // we notify the surface.
467
472
{
468
473
td .renderer_state .mutex .lock ();
469
474
defer td .renderer_state .mutex .unlock ();
470
475
const t = td .renderer_state .terminal ;
471
-
472
- // We assume we're in some sort of password input if we're
473
- // in canonical mode and not echoing. This is a heuristic.
474
- t .flags .password_input = mode .canonical and ! mode .echo ;
476
+ if (t .flags .password_input == password_input ) {
477
+ break :mode_change ;
478
+ }
475
479
}
476
480
477
- // Notify the renderer of our state change
478
- exec .renderer_wakeup .notify () catch | err | {
479
- log .warn ("error notifying renderer err={}" , .{err });
480
- };
481
+ // We have to notify the surface that we're in password input.
482
+ // We must block on this because the balanced true/false state
483
+ // of this is critical to apprt behavior.
484
+ _ = td .surface_mailbox .push (.{
485
+ .password_input = password_input ,
486
+ }, .{ .forever = {} });
481
487
}
482
488
483
489
// Repeat the timer
@@ -645,9 +651,6 @@ pub const ThreadData = struct {
645
651
/// to prevent unnecessary locking of expensive mutexes.
646
652
termios_mode : ptypkg.Mode = .{},
647
653
648
- /// The handle to wake up the renderer.
649
- renderer_wakeup : xev.Async ,
650
-
651
654
pub fn deinit (self : * ThreadData , alloc : Allocator ) void {
652
655
posix .close (self .read_thread_pipe );
653
656
0 commit comments