DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
This is the second time that I have forgotten how NxTerm keyboard input is handled and was inspired to write a Wiki page. The first was when I analyzed CNxConsole Keyboard Input. This time, I am focused on the NxTerm example at apps/examples/nxterm.
Initialization
The NxTerm example initializes the NX Server through the following steps:
- Calls
boardctl(BOARDIOC_NX_START, 0)to start the NX server, then - Calls
nx_connect()to connect to the NX server. - It also creates a separate thread at entry
nxterm_listener()to listen for NX server events.
The Nxterm Example then initializes the Windows:
- Calls
nxtk_openwindow()to create a bordered window, - Calls
nxtk_setposition()andnxtk_setsize()to position the window in the display, - Calls
nxtk_opentoolbar()to create a toolbar sub-window on the main window (This toolbar window is not used by the example, it is just for illustration).
And binds the Nxterm driver to the permit drawing in the window. This is done when it:
- Calls
boardctl(BOARDIOC_NXTERM, (uintptr_t)&nxcreate)
Finally, it sets up the NxTerm and starts the console task:
- Opens the NxTerm driver,
- It then re-directs
stdoutandstderrto the NxTerm driver. This will cause all standard output to be rendered into the main windows, and - It then starts a separate console daemon that inherits the re-directed output and exits.
Character I/O: Normal Case
Keyboard and mouse inputs are received by the application through window callbacks, just like with the Xorg X server. Some listener needs to inject the keyboard input via nx_kbdin() (libs/libnx/nx_kbdin.c) which sends a message containing the keyboard input to the NX server. The NX server will forward that keyboard input to the window that has focus.
...