Mercurial > octave-nkf
annotate gui/qtermwidget/lib/kpty.h @ 14240:a9992bc3c3f7 gui
GUI: Added qtermwidget snapshot as a subproject to build as a library that links with Octave GUI.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sat, 21 Jan 2012 11:26:36 +0100 |
parents | fd14634f9c1e |
children |
rev | line source |
---|---|
13347
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
1 /* This file is part of the KDE libraries |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
2 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
3 Copyright (C) 2003,2007 Oswald Buddenhagen <ossi@kde.org> |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
4 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
5 Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
6 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
7 This library is free software; you can redistribute it and/or |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
8 modify it under the terms of the GNU Library General Public |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
9 License as published by the Free Software Foundation; either |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
10 version 2 of the License, or (at your option) any later version. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
11 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
12 This library is distributed in the hope that it will be useful, |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
15 Library General Public License for more details. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
16 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
17 You should have received a copy of the GNU Library General Public License |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
18 along with this library; see the file COPYING.LIB. If not, write to |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
20 Boston, MA 02110-1301, USA. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
21 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
22 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
23 #ifndef kpty_h |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
24 #define kpty_h |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
25 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
26 #include <QtCore> |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
27 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
28 struct KPtyPrivate; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
29 struct termios; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
30 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
31 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
32 * Provides primitives for opening & closing a pseudo TTY pair, assigning the |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
33 * controlling TTY, utmp registration and setting various terminal attributes. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
34 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
35 class KPty { |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
36 Q_DECLARE_PRIVATE(KPty) |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
37 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
38 public: |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
39 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
40 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
41 * Constructor |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
42 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
43 KPty(); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
44 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
45 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
46 * Destructor: |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
47 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
48 * If the pty is still open, it will be closed. Note, however, that |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
49 * an utmp registration is @em not undone. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
50 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
51 ~KPty(); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
52 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
53 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
54 * Create a pty master/slave pair. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
55 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
56 * @return true if a pty pair was successfully opened |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
57 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
58 bool open(); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
59 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
60 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
61 * Close the pty master/slave pair. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
62 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
63 void close(); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
64 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
65 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
66 * Close the pty slave descriptor. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
67 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
68 * When creating the pty, KPty also opens the slave and keeps it open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
69 * Consequently the master will never receive an EOF notification. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
70 * Usually this is the desired behavior, as a closed pty slave can be |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
71 * reopened any time - unlike a pipe or socket. However, in some cases |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
72 * pipe-alike behavior might be desired. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
73 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
74 * After this function was called, slaveFd() and setCTty() cannot be |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
75 * used. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
76 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
77 void closeSlave(); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
78 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
79 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
80 * Creates a new session and process group and makes this pty the |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
81 * controlling tty. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
82 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
83 void setCTty(); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
84 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
85 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
86 * Creates an utmp entry for the tty. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
87 * This function must be called after calling setCTty and |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
88 * making this pty the stdin. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
89 * @param user the user to be logged on |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
90 * @param remotehost the host from which the login is coming. This is |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
91 * @em not the local host. For remote logins it should be the hostname |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
92 * of the client. For local logins from inside an X session it should |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
93 * be the name of the X display. Otherwise it should be empty. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
94 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
95 void login(const char *user = 0, const char *remotehost = 0); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
96 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
97 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
98 * Removes the utmp entry for this tty. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
99 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
100 void logout(); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
101 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
102 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
103 * Wrapper around tcgetattr(3). |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
104 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
105 * This function can be used only while the PTY is open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
106 * You will need an #include <termios.h> to do anything useful |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
107 * with it. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
108 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
109 * @param ttmode a pointer to a termios structure. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
110 * Note: when declaring ttmode, @c struct @c ::termios must be used - |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
111 * without the '::' some version of HP-UX thinks, this declares |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
112 * the struct in your class, in your method. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
113 * @return @c true on success, false otherwise |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
114 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
115 bool tcGetAttr(struct ::termios *ttmode) const; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
116 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
117 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
118 * Wrapper around tcsetattr(3) with mode TCSANOW. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
119 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
120 * This function can be used only while the PTY is open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
121 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
122 * @param ttmode a pointer to a termios structure. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
123 * @return @c true on success, false otherwise. Note that success means |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
124 * that @em at @em least @em one attribute could be set. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
125 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
126 bool tcSetAttr(struct ::termios *ttmode); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
127 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
128 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
129 * Change the logical (screen) size of the pty. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
130 * The default is 24 lines by 80 columns. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
131 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
132 * This function can be used only while the PTY is open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
133 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
134 * @param lines the number of rows |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
135 * @param columns the number of columns |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
136 * @return @c true on success, false otherwise |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
137 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
138 bool setWinSize(int lines, int columns); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
139 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
140 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
141 * Set whether the pty should echo input. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
142 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
143 * Echo is on by default. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
144 * If the output of automatically fed (non-interactive) PTY clients |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
145 * needs to be parsed, disabling echo often makes it much simpler. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
146 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
147 * This function can be used only while the PTY is open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
148 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
149 * @param echo true if input should be echoed. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
150 * @return @c true on success, false otherwise |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
151 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
152 bool setEcho(bool echo); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
153 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
154 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
155 * @return the name of the slave pty device. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
156 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
157 * This function should be called only while the pty is open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
158 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
159 const char *ttyName() const; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
160 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
161 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
162 * @return the file descriptor of the master pty |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
163 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
164 * This function should be called only while the pty is open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
165 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
166 int masterFd() const; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
167 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
168 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
169 * @return the file descriptor of the slave pty |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
170 * |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
171 * This function should be called only while the pty slave is open. |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
172 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
173 int slaveFd() const; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
174 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
175 protected: |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
176 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
177 * @internal |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
178 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
179 KPty(KPtyPrivate *d); |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
180 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
181 /** |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
182 * @internal |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
183 */ |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
184 KPtyPrivate * const d_ptr; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
185 }; |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
186 |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
187 #endif |
fd14634f9c1e
Integrated qtermwidget terminal emulation.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
188 |