summaryrefslogtreecommitdiff
path: root/qt
Unidiff
Diffstat (limited to 'qt') (more/less context) (ignore whitespace changes)
-rw-r--r--qt/qt-2.3.7.patch/qte237-0-vtswitch.patch205
-rw-r--r--qt/qt-2.3.7.patch/qte237-1-daemon.patch113
2 files changed, 318 insertions, 0 deletions
diff --git a/qt/qt-2.3.7.patch/qte237-0-vtswitch.patch b/qt/qt-2.3.7.patch/qte237-0-vtswitch.patch
new file mode 100644
index 0000000..be2745c
--- a/dev/null
+++ b/qt/qt-2.3.7.patch/qte237-0-vtswitch.patch
@@ -0,0 +1,205 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- qt-2.3.7/src/kernel/qapplication_qws.cpp~vt-switch.patch
7+++ qt-2.3.7/src/kernel/qapplication_qws.cpp
8@@ -123,6 +123,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@@ -163,6 +169,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@@ -1628,6 +1636,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@@ -1652,6 +1669,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@@ -1702,7 +1766,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@@ -2584,7 +2677,7 @@
139 if ( !widget ) { // don't know this window
140 if ( !QWidget::mouseGrabber()
141 #ifndef QT_NO_QWS_MANAGER
142 - && !QWSManager::grabbedMouse()
143 + && !QWSManager::grabbedMouse()
144 #endif
145 ) {
146 qt_last_cursor = 0xffffffff; // cursor can be changed by another application
147@@ -3394,7 +3487,7 @@
148 #ifndef QT_NO_QWS_IM
149 if ( mouse.state&button && w != QInputContext::microFocusWidget() ) //button press
150 QInputContext::reset( oldFocus );
151 -#endif
152+#endif
153 QFocusEvent::setReason( QFocusEvent::Mouse);
154 w->setFocus();
155 QFocusEvent::resetReason();
156@@ -3540,7 +3633,7 @@
157 QApplication::sendEvent( widget, &enter );
158 (*mouseInWidget) = widget;
159 #ifndef QT_NO_QWS_IM
160 - if ( e.type() == QEvent::MouseButtonPress &&
161 + if ( e.type() == QEvent::MouseButtonPress &&
162 !widget->testWFlags( Qt::WStyle_Tool ) &&
163 !widget->topLevelWidget()->testWFlags( Qt::WStyle_Tool ) )
164 QInputContext::reset( oldFocus );
165--- qt-2.3.7/src/kernel/qkeyboard_qws.cpp~vt-switch.patch
166+++ qt-2.3.7/src/kernel/qkeyboard_qws.cpp
167@@ -1068,6 +1068,24 @@
168 {
169 if (kbdFD >= 0)
170 {
171+
172+#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
173+ struct vt_mode vtMode;
174+ ioctl(kbdFD, VT_GETMODE, &vtMode);
175+
176+ /* Mickey says: "Better give up control of VT switching.
177+ * Hey, I really hate that OS-will-reacquire-resources on process-death
178+ * kind of thinking!
179+ */
180+ vtMode.mode = VT_AUTO;
181+ vtMode.relsig = 0;
182+ vtMode.acqsig = 0;
183+ ioctl(kbdFD, VT_SETMODE, &vtMode);
184+
185+ signal(VTSWITCHSIG, 0);
186+ qDebug( "~QWSTtyKeyboardHandler() - released VT." );
187+#endif
188+
189 #if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
190 ioctl(kbdFD, KDSKBMODE, K_XLATE);
191 #endif
192--- qt-2.3.7/src/kernel/qgfxlinuxfb_qws.cpp~vt-switch.patch
193+++ qt-2.3.7/src/kernel/qgfxlinuxfb_qws.cpp
194@@ -251,9 +251,9 @@
195
196 bool QLinuxFbScreen::initDevice()
197 {
198- // No blankin' screen, no blinkin' cursor!, no cursor!
199+ /* Setting up the VT parameters is done in qapplication_qws.cpp
200 const char termctl[]="\033[9;0]\033[?33l\033[?25l";
201- writeTerm(termctl,sizeof(termctl));
202+ writeTerm(termctl,sizeof(termctl)); */
203
204 // Grab current mode so we can reset it
205 fb_var_screeninfo vinfo;
diff --git a/qt/qt-2.3.7.patch/qte237-1-daemon.patch b/qt/qt-2.3.7.patch/qte237-1-daemon.patch
new file mode 100644
index 0000000..1f83398
--- a/dev/null
+++ b/qt/qt-2.3.7.patch/qte237-1-daemon.patch
@@ -0,0 +1,113 @@
1
2#
3# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
4#
5
6 --- qt-2.3.7/src/kernel/qapplication_qws.cpp~daemonize2004-07-17 22:47:54.840820000 +0200
7 +++ qt-2.3.7/src/kernel/qapplication_qws.cpp2004-07-17 23:34:32.407525912 +0200
8@@ -103,6 +103,7 @@
9 #endif
10
11 #include <sys/time.h>
12+#include <syslog.h>
13
14 #if defined(_OS_AIX_) && defined(_CC_GNU_)
15 #include <sys/select.h>
16@@ -162,6 +163,7 @@
17 //these used to be environment variables, they are initialized from
18 //environment variables in
19
20+bool qws_daemon = TRUE;
21 bool qws_savefonts = FALSE;
22 bool qws_screen_is_interlaced=FALSE; //### should be detected
23 bool qws_shared_memory = FALSE;
24@@ -1614,6 +1616,10 @@
25 mwGeometry = argv[i];
26 } else if ( arg == "-shared" ) {
27 qws_shared_memory = TRUE;
28 +} else if ( arg == "-daemon" ) {
29 + qws_daemon = TRUE;
30 +} else if ( arg == "-nodaemon" ) {
31 + qws_daemon = FALSE;
32 } else if ( arg == "-noshared" ) {
33 qws_shared_memory = FALSE;
34 } else if ( arg == "-savefonts" ) {
35@@ -1670,6 +1676,78 @@
36 qt_appType = type;
37 qws_single_process = TRUE;
38
39+ /* Daemonize the server process -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
40+ * Added a new command line option which only is relevant if the application is created as a GuiServer.
41+ * The option is -daemon respectively -nodaemon. If in daemon mode (which is the default now), the
42+ * server will detach from the controlling terminal and continue as a daemon. This is done via the standard
43+ * UNIX double fork magic.
44+ */
45+ if ( qws_daemon )
46+ {
47+ qWarning( "qt_init() - starting in daemon mode..." );
48+
49+ int pid1 = fork();
50+ if ( pid1 == -1 )
51+ {
52+ qWarning( "qt_init() - can't perform initial fork: %s", strerror( errno ) );
53+ exit( -1 );
54+ }
55+ if ( pid1 ) _exit( 0 ); // ok, first fork performed
56+
57+ chdir( "/" );
58+ setsid();
59+ umask(0);
60+ close(0);
61+ close(1);
62+ close(2);
63+
64+ int fdnull = ::open( "/dev/null", O_RDWR );
65+ if ( fdnull == -1 )
66+ {
67+ syslog( 3, "qt_init() - can't open /dev/null to redirect std{in|out|err}: %s", strerror( errno ) );
68+ exit( -1 );
69+ }
70+ dup2( fdnull, 0 ); // stdin
71+ dup2( fdnull, 1 ); // stdout
72+ dup2( fdnull, 2 ); // stderr
73+
74+ int pid2 = fork();
75+ if ( pid2 == -1 )
76+ {
77+ syslog( 3, "qt_init() - can't perform initial fork: %s", strerror( errno ) );
78+ exit( -1 );
79+ }
80+ if ( pid2 )
81+ {
82+ syslog( 4, "qt_init() [%d] - successfully entered daemon mode", pid2 );
83+ _exit( 0 ); // ok, second fork performed
84+ }
85+ }
86+
87+ /*
88+ * , ,
89+ * /( )`
90+ * \ \___ / | B E W A R E !
91+ * /- _ `-/ ' We are a DAEMON now!
92+ * (/\/ \ \ /\
93+ * / / | ` \
94+ * O O ) / |
95+ * `-^--'`< '
96+ * (_.) _ ) /
97+ * `.___/` /
98+ * `-----' /
99+ * <----. __ / __ \
100+ * <----|====O)))==) \) /====
101+ * <----' `--' `.__,' \
102+ * | |
103+ * \ /
104+ * ______( (_ / \______
105+ * (FL) ,' ,-----' | \
106+ * `--{__________) \/
107+ *
108+ */
109+
110+
111 /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
112 * Added a new command line option which only is relevant if the application is created as a GuiServer.
113 * The option is -terminal <num>, where <num> specifies the virtual terminal to be occupied by the server.