summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.7/src/kernel/qapplication_qws.cpp~vt-switch.patch
++++ qt-2.3.7/src/kernel/qapplication_qws.cpp
+@@ -123,6 +123,12 @@
+ static int qt_thread_pipe[2];
+ #endif
+
++#if defined(_OS_LINUX_)
++#include <sys/ioctl.h>
++#include <linux/vt.h>
++#include <linux/kd.h>
++#endif
++
+ const int qwsSharedRamSize = 32 * 1024; //Small amount to fit on small devices.
+
+ // These are in qapplication.cpp in qt/main
+@@ -163,6 +169,8 @@
+ bool qws_accel = TRUE; // ### never set
+ const char *qws_display_spec = ":0";
+ int qws_display_id = 0;
++int qws_terminal_id = 0;
++int qws_terminal_old = 0;
+ int qws_client_id = 0;
+ QWidget *qt_pressGrab = 0;
+ QWidget *qt_mouseGrb = 0;
+@@ -1628,6 +1636,15 @@
+ type = QApplication::GuiServer;
+ } else if ( arg == "-interlaced" ) {
+ qws_screen_is_interlaced = TRUE;
++ } else if ( arg == "-terminal" ) {
++ if ( ++i < argc )
++ {
++ if ( ( qws_terminal_id = atoi( argv[i] ) ) < 1 )
++ {
++ qWarning( "Ignoring Invalid Terminal Specification." );
++ qws_terminal_id = 0;
++ }
++ }
+ } else if ( arg == "-display" ) {
+ if ( ++i < argc )
+ qws_display_spec = argv[i];
+@@ -1652,6 +1669,53 @@
+ if ( type == QApplication::GuiServer ) {
+ qt_appType = type;
+ qws_single_process = TRUE;
++
++ /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ * Added a new command line option which only is relevant if the application is created as a GuiServer.
++ * The option is -terminal <num>, where <num> specifies the virtual terminal to be occupied by the server.
++ * As default in Linux, 0 means the current virtual terminal.
++ */
++ #if defined(_OS_LINUX_)
++ if ( qws_terminal_id )
++ {
++ qDebug( "qt_init() - terminal specification is '%d'.", qws_terminal_id );
++ struct vt_stat console_stat;
++ int console_fd = ::open( QString().sprintf( "/dev/tty%d", qws_terminal_id ).latin1(), O_RDWR );
++ if ( console_fd == -1)
++ {
++ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( ioctl( console_fd, VT_GETSTATE, &console_stat ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_GETSTATE): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ qws_terminal_old = console_stat.v_active;
++ qDebug( "qt_init() - active vt is #%d, switching to #%d as requested...", qws_terminal_old, qws_terminal_id );
++
++ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_id ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( ioctl( console_fd, VT_WAITACTIVE, qws_terminal_id ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_WAITACTIVE): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( ioctl( console_fd, KDSETMODE, KD_GRAPHICS ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_GRAPHICS): %s", strerror( errno ) );
++ exit( -1 );
++ }
++ ::close( console_fd );
++ }
++ else
++ {
++ qDebug( "QWSApplication::qt_init() - current terminal specified." );
++ }
++ #endif
+ QWSServer::startup(flags);
+ setenv("QWS_DISPLAY", qws_display_spec, 0);
+ }
+@@ -1702,7 +1766,36 @@
+ QFontManager::cleanup();
+
+ if ( qws_single_process ) {
+- QWSServer::closedown();
++ qDebug( "qt_cleanup() - shutting down QWSServer..." );
++#ifndef QT_NO_QWS_KEYBOARD
++ if ( qwsServer )
++ qwsServer->closeKeyboard();
++#endif
++ QWSServer::closedown();
++#if defined(_OS_LINUX_)
++ if ( qws_terminal_old > 0 )
++ {
++ qDebug( "qt_cleanup() - switching back to virtual terminal #%d", qws_terminal_old );
++
++ int console_fd = ::open( "/dev/tty0", O_RDWR );
++ if ( console_fd == -1)
++ {
++ qWarning( "qt_init() - can't open tty: %s", strerror( errno ) );
++ }
++ else
++ {
++ if ( ioctl( console_fd, KDSETMODE, KD_TEXT ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(KDSETMODE:KD_TEXT): %s", strerror( errno ) );
++ }
++ if ( ioctl( console_fd, VT_ACTIVATE, qws_terminal_old ) == -1 )
++ {
++ qWarning( "qt_init() - can't ioctl(VT_ACTIVATE): %s", strerror( errno ) );
++ }
++ ::close( console_fd );
++ }
++ }
++#endif
+ }
+ if ( qt_is_gui_used ) {
+ delete qt_fbdpy;
+@@ -2584,7 +2677,7 @@
+ if ( !widget ) { // don't know this window
+ if ( !QWidget::mouseGrabber()
+ #ifndef QT_NO_QWS_MANAGER
+- && !QWSManager::grabbedMouse()
++ && !QWSManager::grabbedMouse()
+ #endif
+ ) {
+ qt_last_cursor = 0xffffffff; // cursor can be changed by another application
+@@ -3394,7 +3487,7 @@
+ #ifndef QT_NO_QWS_IM
+ if ( mouse.state&button && w != QInputContext::microFocusWidget() ) //button press
+ QInputContext::reset( oldFocus );
+-#endif
++#endif
+ QFocusEvent::setReason( QFocusEvent::Mouse);
+ w->setFocus();
+ QFocusEvent::resetReason();
+@@ -3540,7 +3633,7 @@
+ QApplication::sendEvent( widget, &enter );
+ (*mouseInWidget) = widget;
+ #ifndef QT_NO_QWS_IM
+- if ( e.type() == QEvent::MouseButtonPress &&
++ if ( e.type() == QEvent::MouseButtonPress &&
+ !widget->testWFlags( Qt::WStyle_Tool ) &&
+ !widget->topLevelWidget()->testWFlags( Qt::WStyle_Tool ) )
+ QInputContext::reset( oldFocus );
+--- qt-2.3.7/src/kernel/qkeyboard_qws.cpp~vt-switch.patch
++++ qt-2.3.7/src/kernel/qkeyboard_qws.cpp
+@@ -1068,6 +1068,24 @@
+ {
+ if (kbdFD >= 0)
+ {
++
++#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
++ struct vt_mode vtMode;
++ ioctl(kbdFD, VT_GETMODE, &vtMode);
++
++ /* Mickey says: "Better give up control of VT switching.
++ * Hey, I really hate that OS-will-reacquire-resources on process-death
++ * kind of thinking!
++ */
++ vtMode.mode = VT_AUTO;
++ vtMode.relsig = 0;
++ vtMode.acqsig = 0;
++ ioctl(kbdFD, VT_SETMODE, &vtMode);
++
++ signal(VTSWITCHSIG, 0);
++ qDebug( "~QWSTtyKeyboardHandler() - released VT." );
++#endif
++
+ #if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
+ ioctl(kbdFD, KDSKBMODE, K_XLATE);
+ #endif
+--- qt-2.3.7/src/kernel/qgfxlinuxfb_qws.cpp~vt-switch.patch
++++ qt-2.3.7/src/kernel/qgfxlinuxfb_qws.cpp
+@@ -251,9 +251,9 @@
+
+ bool QLinuxFbScreen::initDevice()
+ {
+- // No blankin' screen, no blinkin' cursor!, no cursor!
++ /* Setting up the VT parameters is done in qapplication_qws.cpp
+ const char termctl[]="\033[9;0]\033[?33l\033[?25l";
+- writeTerm(termctl,sizeof(termctl));
++ writeTerm(termctl,sizeof(termctl)); */
+
+ // Grab current mode so we can reset it
+ 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 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+--- qt-2.3.7/src/kernel/qapplication_qws.cpp~daemonize 2004-07-17 22:47:54.840820000 +0200
++++ qt-2.3.7/src/kernel/qapplication_qws.cpp 2004-07-17 23:34:32.407525912 +0200
+@@ -103,6 +103,7 @@
+ #endif
+
+ #include <sys/time.h>
++#include <syslog.h>
+
+ #if defined(_OS_AIX_) && defined(_CC_GNU_)
+ #include <sys/select.h>
+@@ -162,6 +163,7 @@
+ //these used to be environment variables, they are initialized from
+ //environment variables in
+
++bool qws_daemon = TRUE;
+ bool qws_savefonts = FALSE;
+ bool qws_screen_is_interlaced=FALSE; //### should be detected
+ bool qws_shared_memory = FALSE;
+@@ -1614,6 +1616,10 @@
+ mwGeometry = argv[i];
+ } else if ( arg == "-shared" ) {
+ qws_shared_memory = TRUE;
++ } else if ( arg == "-daemon" ) {
++ qws_daemon = TRUE;
++ } else if ( arg == "-nodaemon" ) {
++ qws_daemon = FALSE;
+ } else if ( arg == "-noshared" ) {
+ qws_shared_memory = FALSE;
+ } else if ( arg == "-savefonts" ) {
+@@ -1670,6 +1676,78 @@
+ qt_appType = type;
+ qws_single_process = TRUE;
+
++ /* Daemonize the server process -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
++ * Added a new command line option which only is relevant if the application is created as a GuiServer.
++ * The option is -daemon respectively -nodaemon. If in daemon mode (which is the default now), the
++ * server will detach from the controlling terminal and continue as a daemon. This is done via the standard
++ * UNIX double fork magic.
++ */
++ if ( qws_daemon )
++ {
++ qWarning( "qt_init() - starting in daemon mode..." );
++
++ int pid1 = fork();
++ if ( pid1 == -1 )
++ {
++ qWarning( "qt_init() - can't perform initial fork: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( pid1 ) _exit( 0 ); // ok, first fork performed
++
++ chdir( "/" );
++ setsid();
++ umask(0);
++ close(0);
++ close(1);
++ close(2);
++
++ int fdnull = ::open( "/dev/null", O_RDWR );
++ if ( fdnull == -1 )
++ {
++ syslog( 3, "qt_init() - can't open /dev/null to redirect std{in|out|err}: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ dup2( fdnull, 0 ); // stdin
++ dup2( fdnull, 1 ); // stdout
++ dup2( fdnull, 2 ); // stderr
++
++ int pid2 = fork();
++ if ( pid2 == -1 )
++ {
++ syslog( 3, "qt_init() - can't perform initial fork: %s", strerror( errno ) );
++ exit( -1 );
++ }
++ if ( pid2 )
++ {
++ syslog( 4, "qt_init() [%d] - successfully entered daemon mode", pid2 );
++ _exit( 0 ); // ok, second fork performed
++ }
++ }
++
++ /*
++ * , ,
++ * /( )`
++ * \ \___ / | B E W A R E !
++ * /- _ `-/ ' We are a DAEMON now!
++ * (/\/ \ \ /\
++ * / / | ` \
++ * O O ) / |
++ * `-^--'`< '
++ * (_.) _ ) /
++ * `.___/` /
++ * `-----' /
++ * <----. __ / __ \
++ * <----|====O)))==) \) /====
++ * <----' `--' `.__,' \
++ * | |
++ * \ /
++ * ______( (_ / \______
++ * (FL) ,' ,-----' | \
++ * `--{__________) \/
++ *
++ */
++
++
+ /* Allocate a dedicated virtual terminal -- (C) Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ * Added a new command line option which only is relevant if the application is created as a GuiServer.
+ * The option is -terminal <num>, where <num> specifies the virtual terminal to be occupied by the server.