> In general, to insert a different criteria for displaying a frame.
> [detailed description omitted].

Well, thanks, but what problem(s) did you need to debug that this code
caused?

In general I lose the control of the keyboard in the best case. Apart from this, it happens that the cursor blocks somewhere on the screen, or in another case the redisplay is very slow.

So something is not complete every time.