author | sandman <sandman> | 2002-08-28 23:01:58 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-08-28 23:01:58 (UTC) |
commit | 42e4592219600d6919c93dec82635e2b64382b37 (patch) (unidiff) | |
tree | 1201ccb206b2b4176c0886a85093e6ff40cc3cbf | |
parent | c46685713eb4ef4bfd0a9dcb7eb53b883704a759 (diff) | |
download | opie-42e4592219600d6919c93dec82635e2b64382b37.zip opie-42e4592219600d6919c93dec82635e2b64382b37.tar.gz opie-42e4592219600d6919c93dec82635e2b64382b37.tar.bz2 |
- speedup for suspend: don't switch off backlight
- don't call processEvents on resume since it is not really needed anymore
-rw-r--r-- | core/launcher/desktop.cpp | 5 | ||||
-rw-r--r-- | core/launcher/main.cpp | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index fb10602..1ec477c 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -555,151 +555,148 @@ void Desktop::raiseEmail() | |||
555 | // autoStarts apps on resume and start | 555 | // autoStarts apps on resume and start |
556 | void Desktop::execAutoStart() { | 556 | void Desktop::execAutoStart() { |
557 | QString appName; | 557 | QString appName; |
558 | int delay; | 558 | int delay; |
559 | QDateTime now = QDateTime::currentDateTime(); | 559 | QDateTime now = QDateTime::currentDateTime(); |
560 | Config cfg( "autostart" ); | 560 | Config cfg( "autostart" ); |
561 | cfg.setGroup( "AutoStart" ); | 561 | cfg.setGroup( "AutoStart" ); |
562 | appName = cfg.readEntry( "Apps", "" ); | 562 | appName = cfg.readEntry( "Apps", "" ); |
563 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); | 563 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); |
564 | // If the time between suspend and resume was longer then the | 564 | // If the time between suspend and resume was longer then the |
565 | // value saved as delay, start the app | 565 | // value saved as delay, start the app |
566 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 566 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
567 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 567 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
568 | e << QString( appName ); | 568 | e << QString( appName ); |
569 | } | 569 | } |
570 | } | 570 | } |
571 | 571 | ||
572 | #if defined(QPE_HAVE_TOGGLELIGHT) | 572 | #if defined(QPE_HAVE_TOGGLELIGHT) |
573 | #include <qpe/config.h> | 573 | #include <qpe/config.h> |
574 | 574 | ||
575 | #include <sys/ioctl.h> | 575 | #include <sys/ioctl.h> |
576 | #include <sys/types.h> | 576 | #include <sys/types.h> |
577 | #include <fcntl.h> | 577 | #include <fcntl.h> |
578 | #include <unistd.h> | 578 | #include <unistd.h> |
579 | #include <errno.h> | 579 | #include <errno.h> |
580 | #include <linux/ioctl.h> | 580 | #include <linux/ioctl.h> |
581 | #include <time.h> | 581 | #include <time.h> |
582 | #endif | 582 | #endif |
583 | 583 | ||
584 | static bool blanked=FALSE; | 584 | static bool blanked=FALSE; |
585 | 585 | ||
586 | static void blankScreen() | 586 | static void blankScreen() |
587 | { | 587 | { |
588 | if ( !qt_screen ) return; | 588 | if ( !qt_screen ) return; |
589 | /* Should use a big black window instead. | 589 | /* Should use a big black window instead. |
590 | QGfx* g = qt_screen->screenGfx(); | 590 | QGfx* g = qt_screen->screenGfx(); |
591 | g->fillRect(0,0,qt_screen->width(),qt_screen->height()); | 591 | g->fillRect(0,0,qt_screen->width(),qt_screen->height()); |
592 | delete g; | 592 | delete g; |
593 | */ | 593 | */ |
594 | blanked = TRUE; | 594 | blanked = TRUE; |
595 | } | 595 | } |
596 | 596 | ||
597 | static void darkScreen() | 597 | static void darkScreen() |
598 | { | 598 | { |
599 | extern void qpe_setBacklight(int); | 599 | extern void qpe_setBacklight(int); |
600 | qpe_setBacklight(0); // force off | 600 | qpe_setBacklight(0); // force off |
601 | } | 601 | } |
602 | 602 | ||
603 | 603 | ||
604 | void Desktop::togglePower() | 604 | void Desktop::togglePower() |
605 | { | 605 | { |
606 | extern void qpe_setBacklight ( int ); // We need to toggle the LCD fast - no time to send a QCop | 606 | extern void qpe_setBacklight ( int ); // We need to toggle the LCD fast - no time to send a QCop |
607 | 607 | ||
608 | static bool excllock = false; | 608 | static bool excllock = false; |
609 | 609 | ||
610 | if ( excllock ) | 610 | if ( excllock ) |
611 | return; | 611 | return; |
612 | 612 | ||
613 | excllock = true; | 613 | excllock = true; |
614 | 614 | ||
615 | bool wasloggedin = loggedin; | 615 | bool wasloggedin = loggedin; |
616 | loggedin=0; | 616 | loggedin=0; |
617 | suspendTime = QDateTime::currentDateTime(); | 617 | suspendTime = QDateTime::currentDateTime(); |
618 | 618 | ||
619 | qpe_setBacklight ( 0 ); // force LCD off | 619 | //qpe_setBacklight ( 0 ); // force LCD off (sandman: why ????) |
620 | 620 | ||
621 | if ( wasloggedin ) | 621 | if ( wasloggedin ) |
622 | blankScreen(); | 622 | blankScreen(); |
623 | 623 | ||
624 | ODevice::inst ( )-> suspend ( ); | 624 | ODevice::inst ( )-> suspend ( ); |
625 | 625 | ||
626 | QWSServer::screenSaverActivate ( false ); | 626 | QWSServer::screenSaverActivate ( false ); |
627 | 627 | ||
628 | qpe_setBacklight ( -3 ); // force LCD on | 628 | qpe_setBacklight ( -3 ); // force LCD on |
629 | 629 | ||
630 | { | 630 | { |
631 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep | 631 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep |
632 | } | 632 | } |
633 | 633 | ||
634 | if ( wasloggedin ) | 634 | if ( wasloggedin ) |
635 | login(TRUE); | 635 | login(TRUE); |
636 | 636 | ||
637 | execAutoStart(); | 637 | execAutoStart(); |
638 | //qcopBridge->closeOpenConnections(); | 638 | //qcopBridge->closeOpenConnections(); |
639 | //qDebug("called togglePower()!!!!!!"); | ||
640 | |||
641 | qApp-> processEvents ( ); | ||
642 | 639 | ||
643 | excllock = false; | 640 | excllock = false; |
644 | } | 641 | } |
645 | 642 | ||
646 | void Desktop::toggleLight() | 643 | void Desktop::toggleLight() |
647 | { | 644 | { |
648 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 645 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
649 | e << -2; // toggle | 646 | e << -2; // toggle |
650 | } | 647 | } |
651 | 648 | ||
652 | void Desktop::toggleSymbolInput() | 649 | void Desktop::toggleSymbolInput() |
653 | { | 650 | { |
654 | tb->toggleSymbolInput(); | 651 | tb->toggleSymbolInput(); |
655 | } | 652 | } |
656 | 653 | ||
657 | void Desktop::toggleNumLockState() | 654 | void Desktop::toggleNumLockState() |
658 | { | 655 | { |
659 | tb->toggleNumLockState(); | 656 | tb->toggleNumLockState(); |
660 | } | 657 | } |
661 | 658 | ||
662 | void Desktop::toggleCapsLockState() | 659 | void Desktop::toggleCapsLockState() |
663 | { | 660 | { |
664 | tb->toggleCapsLockState(); | 661 | tb->toggleCapsLockState(); |
665 | } | 662 | } |
666 | 663 | ||
667 | void Desktop::styleChange( QStyle &s ) | 664 | void Desktop::styleChange( QStyle &s ) |
668 | { | 665 | { |
669 | QWidget::styleChange( s ); | 666 | QWidget::styleChange( s ); |
670 | int displayw = qApp->desktop()->width(); | 667 | int displayw = qApp->desktop()->width(); |
671 | int displayh = qApp->desktop()->height(); | 668 | int displayh = qApp->desktop()->height(); |
672 | 669 | ||
673 | QSize sz = tb->sizeHint(); | 670 | QSize sz = tb->sizeHint(); |
674 | 671 | ||
675 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 672 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
676 | } | 673 | } |
677 | 674 | ||
678 | void DesktopApplication::shutdown() | 675 | void DesktopApplication::shutdown() |
679 | { | 676 | { |
680 | if ( type() != GuiServer ) | 677 | if ( type() != GuiServer ) |
681 | return; | 678 | return; |
682 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 679 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
683 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), | 680 | connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), |
684 | this, SLOT(shutdown(ShutdownImpl::Type)) ); | 681 | this, SLOT(shutdown(ShutdownImpl::Type)) ); |
685 | sd->showMaximized(); | 682 | sd->showMaximized(); |
686 | } | 683 | } |
687 | 684 | ||
688 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) | 685 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) |
689 | { | 686 | { |
690 | switch ( t ) { | 687 | switch ( t ) { |
691 | case ShutdownImpl::ShutdownSystem: | 688 | case ShutdownImpl::ShutdownSystem: |
692 | execlp("shutdown", "shutdown", "-h", "now", (void*)0); | 689 | execlp("shutdown", "shutdown", "-h", "now", (void*)0); |
693 | break; | 690 | break; |
694 | case ShutdownImpl::RebootSystem: | 691 | case ShutdownImpl::RebootSystem: |
695 | execlp("shutdown", "shutdown", "-r", "now", (void*)0); | 692 | execlp("shutdown", "shutdown", "-r", "now", (void*)0); |
696 | break; | 693 | break; |
697 | case ShutdownImpl::RestartDesktop: | 694 | case ShutdownImpl::RestartDesktop: |
698 | restart(); | 695 | restart(); |
699 | break; | 696 | break; |
700 | case ShutdownImpl::TerminateDesktop: | 697 | case ShutdownImpl::TerminateDesktop: |
701 | prepareForTermination(FALSE); | 698 | prepareForTermination(FALSE); |
702 | 699 | ||
703 | // This is a workaround for a Qt bug | 700 | // This is a workaround for a Qt bug |
704 | // clipboard applet has to stop its poll timer, or Qt/E | 701 | // clipboard applet has to stop its poll timer, or Qt/E |
705 | // will hang on quit() right before it emits aboutToQuit() | 702 | // will hang on quit() right before it emits aboutToQuit() |
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 3ee5e26..5cf624b 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -291,96 +291,97 @@ int initApplication( int argc, char ** argv ) | |||
291 | setenv( "QWS_SIZE", "240x320", 0 ); | 291 | setenv( "QWS_SIZE", "240x320", 0 ); |
292 | #endif | 292 | #endif |
293 | 293 | ||
294 | //Don't flicker at startup: | 294 | //Don't flicker at startup: |
295 | QWSServer::setDesktopBackground( QImage() ); | 295 | QWSServer::setDesktopBackground( QImage() ); |
296 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 296 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
297 | 297 | ||
298 | (void) new ModelKeyFilter ( ); | 298 | (void) new ModelKeyFilter ( ); |
299 | 299 | ||
300 | initBacklight(); | 300 | initBacklight(); |
301 | 301 | ||
302 | AlarmServer::initialize(); | 302 | AlarmServer::initialize(); |
303 | 303 | ||
304 | Desktop *d = new Desktop(); | 304 | Desktop *d = new Desktop(); |
305 | 305 | ||
306 | QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); | 306 | QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); |
307 | QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); | 307 | QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); |
308 | QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); | 308 | QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); |
309 | QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); | 309 | QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); |
310 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 310 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
311 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 311 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
312 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 312 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
313 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 313 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
314 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); | 314 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); |
315 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); | 315 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); |
316 | 316 | ||
317 | (void)new SysFileMonitor(d); | 317 | (void)new SysFileMonitor(d); |
318 | Network::createServer(d); | 318 | Network::createServer(d); |
319 | 319 | ||
320 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 320 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
321 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 321 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
322 | // Make sure calibration widget starts on top. | 322 | // Make sure calibration widget starts on top. |
323 | Calibrate *cal = new Calibrate; | 323 | Calibrate *cal = new Calibrate; |
324 | cal->exec(); | 324 | cal->exec(); |
325 | delete cal; | 325 | delete cal; |
326 | } | 326 | } |
327 | #endif | 327 | #endif |
328 | 328 | ||
329 | d->show(); | 329 | d->show(); |
330 | 330 | ||
331 | int rv = a.exec(); | 331 | int rv = a.exec(); |
332 | 332 | ||
333 | delete d; | 333 | delete d; |
334 | 334 | ||
335 | return rv; | 335 | return rv; |
336 | } | 336 | } |
337 | 337 | ||
338 | static const char *pidfile_path = "/var/run/opie.pid"; | 338 | static const char *pidfile_path = "/var/run/opie.pid"; |
339 | 339 | ||
340 | void create_pidfile ( ) | 340 | void create_pidfile ( ) |
341 | { | 341 | { |
342 | FILE *f; | 342 | FILE *f; |
343 | 343 | ||
344 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 344 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
345 | ::fprintf ( f, "%d", getpid ( )); | 345 | ::fprintf ( f, "%d", getpid ( )); |
346 | ::fclose ( f ); | 346 | ::fclose ( f ); |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | void remove_pidfile ( ) | 350 | void remove_pidfile ( ) |
351 | { | 351 | { |
352 | ::unlink ( pidfile_path ); | 352 | ::unlink ( pidfile_path ); |
353 | } | 353 | } |
354 | 354 | ||
355 | void handle_sigterm ( int sig ) | 355 | void handle_sigterm ( int /* sig */ ) |
356 | { | 356 | { |
357 | if ( qApp ) | 357 | if ( qApp ) |
358 | qApp-> quit ( ); | 358 | qApp-> quit ( ); |
359 | } | 359 | } |
360 | 360 | ||
361 | int main( int argc, char ** argv ) | 361 | int main( int argc, char ** argv ) |
362 | { | 362 | { |
363 | #ifndef SINGLE_APP | 363 | #ifndef SINGLE_APP |
364 | ::signal( SIGCHLD, SIG_IGN ); | 364 | ::signal( SIGCHLD, SIG_IGN ); |
365 | 365 | ||
366 | ::signal ( SIGTERM, handle_sigterm ); | 366 | ::signal ( SIGTERM, handle_sigterm ); |
367 | ::signal ( SIGINT, handle_sigterm ); | ||
367 | 368 | ||
368 | ::setsid ( ); | 369 | ::setsid ( ); |
369 | ::setpgid ( 0, 0 ); | 370 | ::setpgid ( 0, 0 ); |
370 | 371 | ||
371 | ::atexit ( remove_pidfile ); | 372 | ::atexit ( remove_pidfile ); |
372 | create_pidfile ( ); | 373 | create_pidfile ( ); |
373 | #endif | 374 | #endif |
374 | 375 | ||
375 | int retVal = initApplication ( argc, argv ); | 376 | int retVal = initApplication ( argc, argv ); |
376 | 377 | ||
377 | #ifndef SINGLE_APP | 378 | #ifndef SINGLE_APP |
378 | // Kill them. Kill them all. | 379 | // Kill them. Kill them all. |
379 | ::kill ( 0, SIGTERM ); | 380 | ::kill ( 0, SIGTERM ); |
380 | ::sleep( 1 ); | 381 | ::sleep( 1 ); |
381 | ::kill ( 0, SIGKILL ); | 382 | ::kill ( 0, SIGKILL ); |
382 | #endif | 383 | #endif |
383 | 384 | ||
384 | return retVal; | 385 | return retVal; |
385 | } | 386 | } |
386 | 387 | ||