|
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.52">
Embedding applicationsOne may wish to embed an existing curses or simple text-based application within a prettier frame-work, and/or add extra macro or session functionality to simplify its use. One such example of this is the Crescendo application, which embeds the TinyFuge mud client into a gnome-aware GUI application and provides some point-and-click functionality. This is very easy to do using the ZvtTerm widget. All you have to do is instantiate the widget, and then execute the controlled program in the appropriate environment. The and functions are used for this purpose. Further information can be found in the section called Terminal input and output about how to interact with the subordinate application. Creating an appropriate widgetTypically applications such as these are designed to run in a 80x24 character-mode terminal, you should use zvt_term_new_with_size() to create the initial 80x24 terminal. You may also need to force the application window not to be resized, if the embedded application cannot handle it. This can be done using the normal GDK/GTK+ window hints mechanism. Creating an appropriate execution environmentThe function should be used to create the child process required to execute the program in. It works just like fork(2) with some additional features. This will setup the pseudo tty (pty) for the subordinate program, and register the login session if required. ZvtTerm uses a secure set-uid helper application to register the session, so applications need not (and should not!) be run as a privileged user to register login sessions. The environment must also be setup appropriately if any curses/nurses or similar application is to be run within the terminal. The following environmental variables should be modified/set as shown:
These should only be set in the child process (that which received a 0 return value from zvt_term_forkpty()). The program should then be executed using execle(2), execpe(2) or similar. If these environment variables are not set, the terminal will still function, but any embedded application may not properly display. Setting up an exit handlerThe widget will generate a "child_died" signal when the child process terminates. This signal should be caught if you wish to detect when the subordinate process exits. |