Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reels demo terminates on resize #390

Closed
dankamongmen opened this issue Feb 29, 2020 · 5 comments
Closed

reels demo terminates on resize #390

dankamongmen opened this issue Feb 29, 2020 · 5 comments
Assignees
Labels
bug Something isn't working demo relevant to notcurses-demo
Milestone

Comments

@dankamongmen
Copy link
Owner

If we resize the notcurses-demo window while the reels demo is running, the demo exits immediately. It ought instead take the resize into account, and redraw.

@dankamongmen dankamongmen added bug Something isn't working demo relevant to notcurses-demo labels Feb 29, 2020
@dankamongmen dankamongmen added this to the 1.3.0 milestone Feb 29, 2020
@dankamongmen dankamongmen self-assigned this Feb 29, 2020
@dankamongmen
Copy link
Owner Author

We're exiting out in the handle_input() when we come back to the top of the loop, and this is happening when we press most buttons :/.

@dankamongmen
Copy link
Owner Author

Hrmm. This is somewhat complex, and has ramifications for #373. Demos don't call notcurses_getc() directly, but instead demo_getc() and demo_getc_nblock(). This is necessary, since the demo controller always grabs input, looking for top-level controls.

Note that if we enter raw mode, we are planning to drain input internally to notcurses (to properly handle e.g. Ctrl+C without latency), so we'll see the same situation.

The problem is that we then can't use poll() to determine whether input is available. It's already been removed. The reel demo needs both watch input and an eventfd (written to by way of ncreel_touch() from tablet_thread()). It's POLLIN on stdin thus is borked (it only picks up on a later event). Hrmm.

My initial idea is that such a scheme can use its own eventfd/pipe. Kinda heavyweight, but it works, and also allows us to handle e.g. multibyte input entirely in the primary receiver...

@dankamongmen
Copy link
Owner Author

We can solve this for the purpose of reel by going ahead and doing a trial run of the eventfd idea, connected from the demo input handler out to reel.

dankamongmen added a commit that referenced this issue Mar 1, 2020
When we process input in the demo, write a packet to an
eventfd we set up in input_dispatcher(). This way,
demo components can poll() on that. #390
@dankamongmen
Copy link
Owner Author

No longer happening for most keypresses, but still happening for NCKEY_RESIZE. Odd.

@dankamongmen
Copy link
Owner Author

Ahhh, the remaining NCKEY_RESIZE was blowing up due to poll() being interrupted by SIGWINCH. I've wrapped EINTR, and things now all work properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working demo relevant to notcurses-demo
Projects
None yet
Development

No branches or pull requests

1 participant