author | zecke <zecke> | 2003-10-04 07:28:05 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-10-04 07:28:05 (UTC) |
commit | 23f729eb7487ad189591c3b0c9af9d3afecd3b91 (patch) (unidiff) | |
tree | 83b7efa5996ffcbf22f36b370505eb11fdece4ff | |
parent | 364d30ca7c212a531b79bb7cbceb8af7a0130f2c (diff) | |
download | opie-23f729eb7487ad189591c3b0c9af9d3afecd3b91.zip opie-23f729eb7487ad189591c3b0c9af9d3afecd3b91.tar.gz opie-23f729eb7487ad189591c3b0c9af9d3afecd3b91.tar.bz2 |
Avoid crashing on no mouse driver
-rw-r--r-- | core/apps/calibrate/main.cpp | 3 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 13 |
2 files changed, 9 insertions, 7 deletions
diff --git a/core/apps/calibrate/main.cpp b/core/apps/calibrate/main.cpp index 1c295eb..ec9b5ec 100644 --- a/core/apps/calibrate/main.cpp +++ b/core/apps/calibrate/main.cpp | |||
@@ -24,23 +24,24 @@ | |||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | #ifdef QWS | 26 | #ifdef QWS |
27 | #include <qwindowsystem_qws.h> | 27 | #include <qwindowsystem_qws.h> |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | int main( int argc, char ** argv ) | 30 | int main( int argc, char ** argv ) |
31 | { | 31 | { |
32 | QPEApplication a( argc, argv ); | 32 | QPEApplication a( argc, argv ); |
33 | int retval = 0; | 33 | int retval = 0; |
34 | 34 | ||
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 36 | if ( QWSServer::mouseHandler() && |
37 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | ||
37 | #endif | 38 | #endif |
38 | // Make sure calibration widget starts on top. | 39 | // Make sure calibration widget starts on top. |
39 | Calibrate cal; | 40 | Calibrate cal; |
40 | a.setMainWidget(&cal); | 41 | a.setMainWidget(&cal); |
41 | a.showMainWidget(&cal); | 42 | a.showMainWidget(&cal); |
42 | return a.exec(); | 43 | return a.exec(); |
43 | #ifdef QWS | 44 | #ifdef QWS |
44 | } | 45 | } |
45 | #endif | 46 | #endif |
46 | } | 47 | } |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 7dcb5f6..2103216 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -98,25 +98,25 @@ int main ( int argc, char **argv ) | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | //struct rlimit rl; | 101 | //struct rlimit rl; |
102 | //::getrlimit ( RLIMIT_NOFILE, &rl ); | 102 | //::getrlimit ( RLIMIT_NOFILE, &rl ); |
103 | 103 | ||
104 | //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) | 104 | //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) |
105 | // ::close ( i ); | 105 | // ::close ( i ); |
106 | 106 | ||
107 | ::setpgid ( 0, 0 ); | 107 | ::setpgid ( 0, 0 ); |
108 | ::setsid ( ); | 108 | ::setsid ( ); |
109 | 109 | ||
110 | ::signal ( SIGTERM, sigterm ); | 110 | ::signal ( SIGTERM, sigterm ); |
111 | ::signal ( SIGINT, sigterm ); | 111 | ::signal ( SIGINT, sigterm ); |
112 | 112 | ||
113 | ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); | 113 | ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); |
114 | ::atexit ( exit_closelog ); | 114 | ::atexit ( exit_closelog ); |
115 | 115 | ||
116 | while ( true ) { | 116 | while ( true ) { |
117 | pid_t child = ::fork ( ); | 117 | pid_t child = ::fork ( ); |
118 | 118 | ||
119 | if ( child < 0 ) { | 119 | if ( child < 0 ) { |
120 | ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); | 120 | ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); |
121 | break; | 121 | break; |
122 | } | 122 | } |
@@ -151,25 +151,25 @@ int main ( int argc, char **argv ) | |||
151 | case SIGTERM: | 151 | case SIGTERM: |
152 | case SIGINT : | 152 | case SIGINT : |
153 | case SIGKILL: | 153 | case SIGKILL: |
154 | break; | 154 | break; |
155 | 155 | ||
156 | default : | 156 | default : |
157 | killedbysig = WTERMSIG( status ); | 157 | killedbysig = WTERMSIG( status ); |
158 | break; | 158 | break; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | if ( killedbysig ) { // qpe was killed by an uncaught signal | 161 | if ( killedbysig ) { // qpe was killed by an uncaught signal |
162 | qApp = 0; | 162 | qApp = 0; |
163 | 163 | ||
164 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); | 164 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); |
165 | 165 | ||
166 | QWSServer::setDesktopBackground ( QImage ( )); | 166 | QWSServer::setDesktopBackground ( QImage ( )); |
167 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); | 167 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); |
168 | app-> setFont ( QFont ( "Helvetica", 10 )); | 168 | app-> setFont ( QFont ( "Helvetica", 10 )); |
169 | app-> setStyle ( new QPEStyle ( )); | 169 | app-> setStyle ( new QPEStyle ( )); |
170 | 170 | ||
171 | const char *sig = ::strsignal ( killedbysig ); | 171 | const char *sig = ::strsignal ( killedbysig ); |
172 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); | 172 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); |
173 | l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); | 173 | l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); |
174 | l-> setAlignment ( Qt::AlignCenter ); | 174 | l-> setAlignment ( Qt::AlignCenter ); |
175 | l-> move ( 0, 0 ); | 175 | l-> move ( 0, 0 ); |
@@ -178,37 +178,37 @@ int main ( int argc, char **argv ) | |||
178 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); | 178 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); |
179 | app-> exec ( ); | 179 | app-> exec ( ); |
180 | delete app; | 180 | delete app; |
181 | qApp = 0; | 181 | qApp = 0; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | else { | 184 | else { |
185 | if ( !autolog ) { | 185 | if ( !autolog ) { |
186 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 186 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
187 | Config cfg ( confFile, Config::File ); | 187 | Config cfg ( confFile, Config::File ); |
188 | cfg. setGroup ( "General" ); | 188 | cfg. setGroup ( "General" ); |
189 | QString user = cfg. readEntry ( "AutoLogin" ); | 189 | QString user = cfg. readEntry ( "AutoLogin" ); |
190 | 190 | ||
191 | if ( !user. isEmpty ( )) | 191 | if ( !user. isEmpty ( )) |
192 | autolog = ::strdup ( user. latin1 ( )); | 192 | autolog = ::strdup ( user. latin1 ( )); |
193 | } | 193 | } |
194 | 194 | ||
195 | if ( autolog && !userExited ) { | 195 | if ( autolog && !userExited ) { |
196 | 196 | ||
197 | QWSServer::setDesktopBackground( QImage() ); | 197 | QWSServer::setDesktopBackground( QImage() ); |
198 | ODevice::inst ( )-> setDisplayStatus ( true ); | 198 | ODevice::inst ( )-> setDisplayStatus ( true ); |
199 | ODevice::inst ( )-> setSoftSuspend ( false ); | 199 | ODevice::inst ( )-> setSoftSuspend ( false ); |
200 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 200 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
201 | LoginApplication::setLoginAs ( autolog ); | 201 | LoginApplication::setLoginAs ( autolog ); |
202 | 202 | ||
203 | 203 | ||
204 | if ( LoginApplication::changeIdentity ( )) | 204 | if ( LoginApplication::changeIdentity ( )) |
205 | ::exit ( LoginApplication::login ( )); | 205 | ::exit ( LoginApplication::login ( )); |
206 | else | 206 | else |
207 | ::exit ( 0 ); | 207 | ::exit ( 0 ); |
208 | } | 208 | } |
209 | else { | 209 | else { |
210 | ::exit ( login_main ( argc, argv, ppid )); | 210 | ::exit ( login_main ( argc, argv, ppid )); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | return 0; | 214 | return 0; |
@@ -331,25 +331,26 @@ namespace Opie { extern int force_appearance; } // HACK to get around the force | |||
331 | int login_main ( int argc, char **argv, pid_t ppid ) | 331 | int login_main ( int argc, char **argv, pid_t ppid ) |
332 | { | 332 | { |
333 | QWSServer::setDesktopBackground( QImage() ); | 333 | QWSServer::setDesktopBackground( QImage() ); |
334 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 334 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
335 | 335 | ||
336 | Opie::force_appearance = 0; | 336 | Opie::force_appearance = 0; |
337 | 337 | ||
338 | app-> setFont ( QFont ( "Helvetica", 10 )); | 338 | app-> setFont ( QFont ( "Helvetica", 10 )); |
339 | app-> setStyle ( new QPEStyle ( )); | 339 | app-> setStyle ( new QPEStyle ( )); |
340 | 340 | ||
341 | ODevice::inst ( )-> setSoftSuspend ( true ); | 341 | ODevice::inst ( )-> setSoftSuspend ( true ); |
342 | 342 | ||
343 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 343 | if ( QWSServer::mouseHandler() && |
344 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | ||
344 | if ( !QFile::exists ( "/etc/pointercal" )) { | 345 | if ( !QFile::exists ( "/etc/pointercal" )) { |
345 | // Make sure calibration widget starts on top. | 346 | // Make sure calibration widget starts on top. |
346 | Calibrate *cal = new Calibrate; | 347 | Calibrate *cal = new Calibrate; |
347 | cal-> exec ( ); | 348 | cal-> exec ( ); |
348 | delete cal; | 349 | delete cal; |
349 | } | 350 | } |
350 | } | 351 | } |
351 | 352 | ||
352 | LoginScreenSaver *saver = new LoginScreenSaver; | 353 | LoginScreenSaver *saver = new LoginScreenSaver; |
353 | 354 | ||
354 | saver-> setIntervals ( ); | 355 | saver-> setIntervals ( ); |
355 | QWSServer::setScreenSaver ( saver ); | 356 | QWSServer::setScreenSaver ( saver ); |