QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Can an application started in a terminal (such as pterm) receive mouse events? |
Ref. No. |
QNX.000009882 |
Category(ies) |
Development |
Issue |
We wrote our own version of pterm and then we want the application started by our version to get mouse events.
Do you have any suggestions?
|
Solution |
Applications statred in pterm can get mouse events too. Vedit, is an example of this. A text-mode application running in a PtTty widget can enable and disable mouse events by outputting escape sequences to the terminal.
This way the mouse escape sequences can only be visible to applications that understand them, and your terminal program does not need to do anything special - the escape sequences are all handled by the PtTerminal widget.
The escape sequence to enabel and disable mouse events are: x09<header> <options> h -to enable x09<header> <options> h -to disable
where <header> is
x09ESC [ > -in ANSI mode x09ESC / > -in QNX mode and <options> is a list of decimal numbers separeted by semicolons, in particular:
x091 - enabels mouse presses (Pt_TERM_REPORT_CLICKS) x096 - enables mouse presses (Pt_TERM_REPORT_RELEASE)
x097 - enables mouse presses while dragging (Pt_TERM_REPORT_CURSOR)
Instead of building those escape sequences yourself, it is better to use a mouse-enabled terminal library. The old QNX term library has a term_mouse_on() function. And in the ncurses library there is a curs_mouse() function that turns on the mouse.
|
|