Interlisp / medley

The main repo for the Medley Interlisp project. Wiki, Issues are here. Other repositories include maiko (the VM implementation) and Interlisp.github.io (web site sources)
https://Interlisp.org
MIT License
369 stars 23 forks source link

It'd be nice if the TTY caret was turned off when the Medley window does not have input focus #1770

Open MattHeffron opened 2 weeks ago

MattHeffron commented 2 weeks ago

The TTY caret continues to blink even when the Medley window doesn't have keyboard input focus. This can be a bit confusing as to which system-wide window (e.g., other Windows applications) will receive typed input. (I know only that this is the case on Windows 11, WSL, Ubuntu X11. I do not know if this behavior is the same in other environments; e.g., mac, SDL.)

It'd be nice if the TTY caret was turned off when the Medley window does not have input focus, and restored when the Medley window regains focus.

nbriggs commented 1 week ago

Yes, it's the same on other OSes. Medley background processing is still running even though the X/SDL/whatever window doesn't have the system's input focus, and Medley doesn't know that that is the case. I think it is possible for maiko to notice the loss of input focus, but I'm not sure what it should do about it. It needs to inform the Lisp level, and I haven't had any success with low-level C code calling into the Lisp world - I can set variables, but that would add another check into the background blink check loop. I think in theory it could use the interrupt context to make a call - but it's a bit complicated.

Something to think about when I return, or before if someone else wants to figure out how the interrupt context upcalls should be done.

masinter commented 1 week ago

checking a variable is no problem. The caret is handled by the \TIMER.PROCESS which runs at default priority but waits until the timer expires. So the variable will only be checked when the timer to flash the cursor expires -- every 1/3 second. While the external interface is set by CARETRATE(ONRATE OFFRATE) defaulting to 333 milliseconds. For safety's sake, I'd suggest just changing the caret bitmap and / or the caret rate rather than turning it off completely.

I've been thinking that modifying the caret shape and/or rate would be a better indicator of typeing with cap-locks off to a reader that is case sensitive (Interlisp readtable). (I did a little investigation of this recently) (another Issue?)