6.7. Text mode programs (CUI: Console User Interface)

Text mode programs are program which output is only made out of text (surprise!). In Windows terminolgy, they are called CUI (Console User Interface) executables, by opposition to GUI (Graphical User Interface) executables. Win32 API provide a complete set of APIs to handle this situation, which goes from basic features like text printing, up to high level functionnalities (like full screen editing, color support, cursor motion, mouse support), going through features like line editing or raw/cooked input stream support

Given the wide scope of features above, and the current usage in Un*x world, Wine comes out with three different ways for running a console program (aka a CUI executable):

The names here are a bit obscure. "bare streams" means that no extra support of wine is provide to map between the unix console access and Windows console access. The two other ways require the use of a specific Wine program (wineconsole) which provide extended facilities. The following table describes what you can do (and cannot do) with those three ways.

Table 6-2. Basic differences in consoles

FunctionBare streamsWineconsole & user backendWineconsole & curses backend
How to run (assuming executable is called foo.exe)
$ wine foo.exe
$ wineconsole -- --backend=user foo.exe
$ wineconsole foo.exe
You can also use --backend=curses as an option
Good support for line oriented CUI applications (which print information line after line) YesYesYes
Good support for full screen CUI applications (including but not limited to color support, mouse support...)NoYesYes
Can be run even if X11 is not runningYesNoYes
ImplementationMaps the standard Windows streams to the standard Unix streams (stdin/stdout/stderr) Wineconsole will create a new Window (hence requiring the USER32 DLL is available) where all information will be displayed Wineconsole will use existing unix console (from which the program is run) and with the help of the (n)curses library take control of all the terminal surface for interacting with the user
Known limitations   Will produce strange behavior if two (or more) Windows consoles are used on the same Un*x terminal.

6.7.1. Configuration of CUI executables

When wineconsole is used, several configuration options are available. Wine (as Windows do) stores, on a per application basis, several options in the registry. This let a user, for example, define the default screen-buffer size he would like to have for a given application.

As of today, only the USER backend allows you to edit those options (we don't recommend editing by hand the registry contents). This edition is fired when a user right click in the console (this popups a menu), where you can either choose from:

Here's the list of the items you can configure, and their meanings:

Table 6-3. Wineconsole configuration options

Configuration optionMeaning
Cursor's size Defines the size of the cursor. Three options are available: small (33% of character height), medium (66%) and large (100%)
Popup menu It's been said earlier that wineconsole configuration popup was triggered using a right click in the console's window. However, this can be an issue when the application you run inside wineconsole expects the right click events to be sent to it. By ticking control or shift you select additional modifiers on the right click for opening the popup. For example, ticking shift will send events to the application when you right click the window without shift being hold down, and open the window when you right-click while shift being hold down.
Quick edit This tick box lets you decide whether left-click mouse events shall be interpreted as events to be sent to the underlying application (tick off) or as a selection of rectangular part of the screen to be later on copied onto the clipboard (tick on).
History This lets you pick up how many commands you want the console to recall. You can also drive whether you want, when entering several times the same command - potentially intertwened with others - whether you want to store all of them (tick off) or only the last one (tick on).
Police The Police property sheet allows you to pick the default font for the console (font file, size, background and foreground color).
Screenbuffer & window size The console as you see it is made of two different parts. On one hand there's the screenbuffer which contains all the information your application puts on the screen, and the window which displays a given area of this screen buffer. Note that the window is always smaller or of the same size than the screen buffer. Having a stricly smaller window size will put on scrollbars on the window so that you can see the whole screenbuffer's content.
Close on exit If it's ticked, then the wineconsole will exit when the application within terminates. Otherwise, it'll remain opened until the user manually closes it: this allows seeing the latest information of a program after it has terminated.
Edition mode

When the user enter commands, he or she can choose between several edition modes:

  • Emacs: the same keybindings as under emacs are available. For example, Ctrl-A will bring the cursor to the beginning of the edition line. See your emacs manual for the details of the commands.

  • Win32: this are the standard Windows console key-bindings (mainly using arrows).