summaryrefslogtreecommitdiff
path: root/qt/qt-2.3.10.patch/vt-switch.patch
Unidiff
Diffstat (limited to 'qt/qt-2.3.10.patch/vt-switch.patch') (more/less context) (ignore whitespace changes)
-rw-r--r--qt/qt-2.3.10.patch/vt-switch.patch178
1 files changed, 178 insertions, 0 deletions
diff --git a/qt/qt-2.3.10.patch/vt-switch.patch b/qt/qt-2.3.10.patch/vt-switch.patch
new file mode 100644
index 0000000..4007a5d
--- a/dev/null
+++ b/qt/qt-2.3.10.patch/vt-switch.patch
@@ -0,0 +1,178 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.9-snapshot-20041221/src/kernel/qapplication_qws.cpp~vt-switch.patch
7+++ qt-2.3.9-snapshot-20041221/src/kernel/qapplication_qws.cpp
8@@ -124,6 +124,12 @@
9 static int qt_thread_pipe[2];
10 #endif
11
12+#if defined(_OS_LINUX_)
13+#include <sys/ioctl.h>
14+#include <linux/vt.h>
15+#include <linux/kd.h>
16+#endif
17+
18 const int qwsSharedRamSize = 32 * 1024;//Small amount to fit on small devices.
19
20 // These are in qapplication.cpp in qt/main
21@@ -164,6 +170,8 @@
22 bool qws_accel = TRUE; // ### never set
23 const char *qws_display_spec = ":0";
24 int qws_display_id = 0;
25+int qws_terminal_id = 0;
26+int qws_terminal_old = 0;
27 int qws_client_id = 0;
28 QWidget *qt_pressGrab = 0;
29 QWidget *qt_mouseGrb = 0;
30@@ -1700,6 +1708,15 @@
31 type = QApplication::GuiServer;
32 } else if ( arg == "-interlaced" ) {
33 qws_screen_is_interlaced = TRUE;
34+ } else if ( arg == "-terminal" ) {
35+ if ( ++i < argc )
36+ {
37+ if ( ( qws_terminal_id = atoi( argv[i] ) ) < 1 )
38+ {
39+ qWarning( "Ignoring Invalid Terminal Specification." );
40+ qws_terminal_id = 0;
41+ }
42+ }
43 } else if ( arg == "-display" ) {
44 if ( ++i < argc )
45 qws_display_spec = argv[i];
46@@ -1724,6 +1741,53 @@
47 if ( type == QApplication::GuiServer ) {
48 qt_appType = type;
49 qws_single_process = TRUE;
50+
51+ /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
52+ * Added a new command line option which only is relevant if the application is created as a GuiServer.
53+ * The option is -terminal <num>, where <num> specifies the virtual terminal to be occupied by the server.
54+ * As default in Linux, 0 means the current virtual terminal.
55+ */
56+ #if defined(_OS_LINUX_)
57+ if ( qws_terminal_id )
58+ {
59+ qDebug( "qt_init() - terminal specification is '%d'.", qws_terminal_id );
60+ struct vt_stat console_stat;
61+ int console_fd = ::open( QString().sprintf( "/dev/tty%d", qws_terminal_id ).latin1(), O_RDWR );
62+ if ( console_fd == -1)
63+ {
64+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
65+ exit( -1 );
66+ }
67+ if ( ioctl( console_fd, VT_GETSTATE, &console_stat ) == -1 )
68+ {
69+ qWarning( "qt_init() - can't ioctl(VT_GETSTATE): %s", strerror( errno ) );
70+ exit( -1 );
71+ }
72+ qws_terminal_old = console_stat.v_active;
73+ qDebug( "qt_init() - active vt is #%d, switching to #%d as requested...", qws_terminal_old, qws_terminal_id );
74+
75+ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_id ) == -1 )
76+ {
77+ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
78+ exit( -1 );
79+ }
80+ if ( ioctl( console_fd, VT_WAITACTIVE, qws_terminal_id ) == -1 )
81+ {
82+ qWarning( "qt_init() - can't ioctl(VT_WAITACTIVE): %s", strerror( errno ) );
83+ exit( -1 );
84+ }
85+ if ( ioctl( console_fd, KDSETMODE, KD_GRAPHICS ) == -1 )
86+ {
87+ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_GRAPHICS): %s", strerror( errno ) );
88+ exit( -1 );
89+ }
90+ ::close( console_fd );
91+ }
92+ else
93+ {
94+ qDebug( "QWSApplication::qt_init() - current terminal specified." );
95+ }
96+ #endif
97 QWSServer::startup(flags);
98 setenv("QWS_DISPLAY", qws_display_spec, 0);
99 }
100@@ -1774,7 +1838,36 @@
101 QFontManager::cleanup();
102
103 if ( qws_single_process ) {
104 -QWSServer::closedown();
105+ qDebug( "qt_cleanup() - shutting down QWSServer..." );
106+#ifndef QT_NO_QWS_KEYBOARD
107+ if ( qwsServer )
108+ qwsServer->closeKeyboard();
109+#endif
110+ QWSServer::closedown();
111+#if defined(_OS_LINUX_)
112+ if ( qws_terminal_old > 0 )
113+ {
114+ qDebug( "qt_cleanup() - switching back to virtual terminal #%d", qws_terminal_old );
115+
116+ int console_fd = ::open( "/dev/tty0", O_RDWR );
117+ if ( console_fd == -1)
118+ {
119+ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
120+ }
121+ else
122+ {
123+ if ( ioctl( console_fd, KDSETMODE, KD_TEXT ) == -1 )
124+ {
125+ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_TEXT): %s", strerror( errno ) );
126+ }
127+ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_old ) == -1 )
128+ {
129+ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
130+ }
131+ ::close( console_fd );
132+ }
133+ }
134+#endif
135 }
136 if ( qt_is_gui_used ) {
137 delete qt_fbdpy;
138--- qt-2.3.9-snapshot-20041221/src/kernel/qkeyboard_qws.cpp~vt-switch.patch
139+++ qt-2.3.9-snapshot-20041221/src/kernel/qkeyboard_qws.cpp
140@@ -1247,6 +1247,24 @@
141 {
142 if (kbdFD >= 0)
143 {
144+
145+#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
146+ struct vt_mode vtMode;
147+ ioctl(kbdFD, VT_GETMODE, &vtMode);
148+
149+ /* Mickey says: "Better give up control of VT switching.
150+ * Hey, I really hate that OS-will-reacquire-resources on process-death
151+ * kind of thinking!
152+ */
153+ vtMode.mode = VT_AUTO;
154+ vtMode.relsig = 0;
155+ vtMode.acqsig = 0;
156+ ioctl(kbdFD, VT_SETMODE, &vtMode);
157+
158+ signal(VTSWITCHSIG, 0);
159+ qDebug( "~QWSTtyKeyboardHandler() - released VT." );
160+#endif
161+
162 #if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
163 ioctl(kbdFD, KDSKBMODE, K_XLATE);
164 #endif
165--- qt-2.3.9-snapshot-20041221/src/kernel/qgfxlinuxfb_qws.cpp~vt-switch.patch
166+++ qt-2.3.9-snapshot-20041221/src/kernel/qgfxlinuxfb_qws.cpp
167@@ -251,9 +251,9 @@
168
169 bool QLinuxFbScreen::initDevice()
170 {
171- // No blankin' screen, no blinkin' cursor!, no cursor!
172+ /* Setting up the VT parameters is done in qapplication_qws.cpp
173 const char termctl[]="\033[9;0]\033[?33l\033[?25l";
174- writeTerm(termctl,sizeof(termctl));
175+ writeTerm(termctl,sizeof(termctl)); */
176
177 // Grab current mode so we can reset it
178 fb_var_screeninfo vinfo;