-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp index eb01e50..0a98481 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.cpp +++ b/x11/libqpe-x11/qpe/qpeapplication.cpp | |||
@@ -566,230 +566,230 @@ void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) { | |||
566 | ( w ); | 566 | ( w ); |
567 | w->removeEventFilter( qApp ); | 567 | w->removeEventFilter( qApp ); |
568 | }else { | 568 | }else { |
569 | stylusDict->insert( w, ( void* ) mode ); | 569 | stylusDict->insert( w, ( void* ) mode ); |
570 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 570 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
571 | w->installEventFilter( qApp ); | 571 | w->installEventFilter( qApp ); |
572 | } | 572 | } |
573 | } | 573 | } |
574 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) { | 574 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) { |
575 | if ( stylusDict ) | 575 | if ( stylusDict ) |
576 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 576 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
577 | return LeftOnly; | 577 | return LeftOnly; |
578 | } | 578 | } |
579 | 579 | ||
580 | // eventFilter...... | 580 | // eventFilter...... |
581 | bool QPEApplication::eventFilter( QObject* o, QEvent* e ) { | 581 | bool QPEApplication::eventFilter( QObject* o, QEvent* e ) { |
582 | /* | 582 | /* |
583 | * We want our WM to show Ok and a X button | 583 | * We want our WM to show Ok and a X button |
584 | * on dialogs | 584 | * on dialogs |
585 | * our part is to set the _NET_WM_CONTEXT_ACCEPT | 585 | * our part is to set the _NET_WM_CONTEXT_ACCEPT |
586 | * propery | 586 | * propery |
587 | * and then wait for a client message -zecke | 587 | * and then wait for a client message -zecke |
588 | * on show we will add the prop | 588 | * on show we will add the prop |
589 | */ | 589 | */ |
590 | if (o->inherits("QDialog") && e->type() == QEvent::Show ) { | 590 | if (o->inherits("QDialog") && e->type() == QEvent::Show ) { |
591 | QDialog* dialog = (QDialog*)o; | 591 | QDialog* dialog = (QDialog*)o; |
592 | Atom wm_prot[45]; | 592 | Atom wm_prot[45]; |
593 | int n = 0; | 593 | int n = 0; |
594 | wm_prot[n++] = d->wm_delete_window; | 594 | wm_prot[n++] = d->wm_delete_window; |
595 | wm_prot[n++] = d->wm_take_focus; | 595 | wm_prot[n++] = d->wm_take_focus; |
596 | wm_prot[n++] = d->wm_context_accept; | 596 | wm_prot[n++] = d->wm_context_accept; |
597 | if ( dialog->testWFlags( WStyle_ContextHelp ) ) | 597 | if ( dialog->testWFlags( WStyle_ContextHelp ) ) |
598 | wm_prot[n++] = d->wm_context_help; | 598 | wm_prot[n++] = d->wm_context_help; |
599 | XSetWMProtocols( qt_xdisplay(), dialog->winId(), wm_prot, n ); | 599 | XSetWMProtocols( qt_xdisplay(), dialog->winId(), wm_prot, n ); |
600 | return TRUE; // should be save | 600 | return TRUE; // should be save |
601 | } | 601 | } |
602 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { | 602 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { |
603 | QMouseEvent * me = ( QMouseEvent* ) e; | 603 | QMouseEvent * me = ( QMouseEvent* ) e; |
604 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 604 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
605 | switch (mode) { | 605 | switch (mode) { |
606 | case RightOnHold: | 606 | case RightOnHold: |
607 | switch ( me->type() ) { | 607 | switch ( me->type() ) { |
608 | case QEvent::MouseButtonPress: | 608 | case QEvent::MouseButtonPress: |
609 | if ( me->button() == LeftButton ) { | 609 | if ( me->button() == LeftButton ) { |
610 | d->presstimer = startTimer(500); // #### pref. | 610 | d->presstimer = startTimer(500); // #### pref. |
611 | d->presswidget = (QWidget*)o; | 611 | d->presswidget = (QWidget*)o; |
612 | d->presspos = me->pos(); | 612 | d->presspos = me->pos(); |
613 | d->rightpressed = FALSE; | 613 | d->rightpressed = FALSE; |
614 | } | 614 | } |
615 | break; | 615 | break; |
616 | case QEvent::MouseMove: | 616 | case QEvent::MouseMove: |
617 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { | 617 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { |
618 | killTimer(d->presstimer); | 618 | killTimer(d->presstimer); |
619 | d->presstimer = 0; | 619 | d->presstimer = 0; |
620 | } | 620 | } |
621 | break; | 621 | break; |
622 | case QEvent::MouseButtonRelease: | 622 | case QEvent::MouseButtonRelease: |
623 | if ( me->button() == LeftButton ) { | 623 | if ( me->button() == LeftButton ) { |
624 | if ( d->presstimer ) { | 624 | if ( d->presstimer ) { |
625 | killTimer(d->presstimer); | 625 | killTimer(d->presstimer); |
626 | d->presstimer = 0; | 626 | d->presstimer = 0; |
627 | } | 627 | } |
628 | if ( d->rightpressed && d->presswidget ) { | 628 | if ( d->rightpressed && d->presswidget ) { |
629 | // Right released | 629 | // Right released |
630 | postEvent( d->presswidget, | 630 | postEvent( d->presswidget, |
631 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), | 631 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), |
632 | RightButton, LeftButton + RightButton ) ); | 632 | RightButton, LeftButton + RightButton ) ); |
633 | // Left released, off-widget | 633 | // Left released, off-widget |
634 | postEvent( d->presswidget, | 634 | postEvent( d->presswidget, |
635 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), | 635 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), |
636 | LeftButton, LeftButton ) ); | 636 | LeftButton, LeftButton ) ); |
637 | postEvent( d->presswidget, | 637 | postEvent( d->presswidget, |
638 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), | 638 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), |
639 | LeftButton, LeftButton ) ); | 639 | LeftButton, LeftButton ) ); |
640 | d->rightpressed = FALSE; | 640 | d->rightpressed = FALSE; |
641 | return TRUE; // don't send the real Left release | 641 | return TRUE; // don't send the real Left release |
642 | } | 642 | } |
643 | } | 643 | } |
644 | break; | 644 | break; |
645 | default: | 645 | default: |
646 | break; | 646 | break; |
647 | } | 647 | } |
648 | break; | 648 | break; |
649 | default: | 649 | default: |
650 | ; | 650 | ; |
651 | } | 651 | } |
652 | } | 652 | } |
653 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 653 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
654 | QKeyEvent *ke = (QKeyEvent *)e; | 654 | QKeyEvent *ke = (QKeyEvent *)e; |
655 | if ( ke->key() == Key_Enter ) { | 655 | if ( ke->key() == Key_Enter ) { |
656 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { | 656 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { |
657 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', | 657 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', |
658 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); | 658 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); |
659 | return TRUE; | 659 | return TRUE; |
660 | } | 660 | } |
661 | } | 661 | } |
662 | } | 662 | } |
663 | return FALSE; | 663 | return FALSE; |
664 | } | 664 | } |
665 | 665 | ||
666 | // Quit stuff | 666 | // Quit stuff |
667 | void QPEApplication::restart() { | 667 | void QPEApplication::restart() { |
668 | 668 | ||
669 | } | 669 | } |
670 | void QPEApplication::shutdown() { | 670 | void QPEApplication::shutdown() { |
671 | 671 | ||
672 | } | 672 | } |
673 | void QPEApplication::tryQuit() { | 673 | void QPEApplication::tryQuit() { |
674 | qWarning("TryQuit!!"); | 674 | qWarning("TryQuit!!"); |
675 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 675 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) |
676 | return ; // Inside modal loop or konsole. Too hard to save state. | 676 | return ; // Inside modal loop or konsole. Too hard to save state. |
677 | { | 677 | { |
678 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 678 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
679 | e << d->appName; | 679 | e << d->appName; |
680 | } | 680 | } |
681 | processEvents(); | 681 | processEvents(); |
682 | 682 | ||
683 | quit(); | 683 | quit(); |
684 | } | 684 | } |
685 | void QPEApplication::hideOrQuit() { | 685 | void QPEApplication::hideOrQuit() { |
686 | qWarning("hide or close"); | 686 | qWarning("hide or close"); |
687 | processEvents(); | 687 | processEvents(); |
688 | qWarning("past processing"); | 688 | qWarning("past processing"); |
689 | 689 | ||
690 | // If we are a preloaded application we don't actually quit, so emit | 690 | // If we are a preloaded application we don't actually quit, so emit |
691 | // a System message indicating we're quasi-closing. | 691 | // a System message indicating we're quasi-closing. |
692 | if ( d->preloaded && d->qpe_main_widget ) | 692 | if ( d->preloaded && d->qpe_main_widget ) |
693 | 693 | ||
694 | { | 694 | { |
695 | qWarning("hiding"); | 695 | qWarning("hiding"); |
696 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 696 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
697 | e << d->appName; | 697 | e << d->appName; |
698 | d->qpe_main_widget->hide(); | 698 | d->qpe_main_widget->hide(); |
699 | } | 699 | } |
700 | else | 700 | else |
701 | quit(); | 701 | quit(); |
702 | } | 702 | } |
703 | 703 | ||
704 | /*! | 704 | /*! |
705 | \internal | 705 | \internal |
706 | */ | 706 | */ |
707 | void QPEApplication::prepareForTermination( bool willrestart ) | 707 | void QPEApplication::prepareForTermination( bool willrestart ) |
708 | { | 708 | { |
709 | if ( willrestart ) { | 709 | if ( willrestart ) { |
710 | // Draw a big wait icon, the image can be altered in later revisions | 710 | // Draw a big wait icon, the image can be altered in later revisions |
711 | // QWidget *d = QApplication::desktop(); | 711 | // QWidget *d = QApplication::desktop(); |
712 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 712 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
713 | QPixmap pix; | 713 | QPixmap pix; |
714 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 714 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
715 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 715 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
716 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 716 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
717 | lblWait->setPixmap( pix ); | 717 | lblWait->setPixmap( pix ); |
718 | lblWait->setAlignment( QWidget::AlignCenter ); | 718 | lblWait->setAlignment( QWidget::AlignCenter ); |
719 | lblWait->show(); | 719 | lblWait->show(); |
720 | lblWait->showMaximized(); | 720 | lblWait->showMaximized(); |
721 | } | 721 | } |
722 | #ifndef SINGLE_APP | 722 | #ifndef SINGLE_APP |
723 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 723 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
724 | } | 724 | } |
725 | processEvents(); // ensure the message goes out. | 725 | processEvents(); // ensure the message goes out. |
726 | sleep( 1 ); // You have 1 second to comply. | 726 | sleep( 1 ); // You have 1 second to comply. |
727 | #endif | 727 | #endif |
728 | } | 728 | } |
729 | int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) { | 729 | int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) { |
730 | qWarning("X11 ClientMessage %d %d", event->type, ClientMessage); | 730 | qWarning("X11 ClientMessage %d %d", event->type, ClientMessage); |
731 | if ( event->type == ClientMessage ) { | 731 | if ( event->type == ClientMessage ) { |
732 | if ( (event->xclient.message_type == d->wm_protocols) && | 732 | if ( (event->xclient.message_type == d->wm_protocols) && |
733 | (event->xclient.data.l[0] == d->wm_context_accept ) ) { | 733 | (event->xclient.data.l[0] == d->wm_context_accept ) ) { |
734 | qWarning("accepted!!!"); | 734 | qWarning("accepted!!!"); |
735 | /* | 735 | /* |
736 | * I'm not sure if we should use activeWidget | 736 | * I'm not sure if we should use activeWidget |
737 | * or activeModalWidget | 737 | * or activeModalWidget |
738 | * a QDialog could be not modal too | 738 | * a QDialog could be not modal too |
739 | */ | 739 | */ |
740 | if ( w->inherits("QDialog" ) ) { | 740 | if ( w->inherits("QDialog" ) ) { |
741 | qWarning("inherits QDialog!!!"); | 741 | qWarning("inherits QDialog!!!"); |
742 | QDialog* dia = (QDialog*)w; | 742 | QDialog* dia = (QDialog*)w; |
743 | /* | 743 | /* |
744 | * call it directly or via QTimer::singleShot? | 744 | * call it directly or via QTimer::singleShot? |
745 | */ | 745 | */ |
746 | QTimer::singleShot(0, dia, SLOT(accept() ) ); | 746 | QTimer::singleShot(0, dia, SLOT(accept() ) ); |
747 | return 0; | 747 | return 0; |
748 | } | 748 | } |
749 | 749 | ||
750 | } | 750 | } |
751 | } | 751 | } |
752 | return QApplication::x11ClientMessage(w, event, b ); | 752 | return QApplication::x11ClientMessage(w, event, b ); |
753 | } | 753 | } |
754 | 754 | ||
755 | #define KeyPress XKeyPress | 755 | #define KeyPress XKeyPress |
756 | #define KeyRelease XKeyRelease | 756 | #define KeyRelease XKeyRelease |
757 | 757 | ||
758 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 758 | #if defined(OPIE_NEW_MALLOC) |
759 | 759 | ||
760 | // The libraries with the skiff package (and possibly others) have | 760 | // The libraries with the skiff package (and possibly others) have |
761 | // completely useless implementations of builtin new and delete that | 761 | // completely useless implementations of builtin new and delete that |
762 | // use about 50% of your CPU. Here we revert to the simple libc | 762 | // use about 50% of your CPU. Here we revert to the simple libc |
763 | // functions. | 763 | // functions. |
764 | 764 | ||
765 | void* operator new[]( size_t size ) | 765 | void* operator new[]( size_t size ) |
766 | { | 766 | { |
767 | return malloc( size ); | 767 | return malloc( size ); |
768 | } | 768 | } |
769 | 769 | ||
770 | void* operator new( size_t size ) | 770 | void* operator new( size_t size ) |
771 | { | 771 | { |
772 | return malloc( size ); | 772 | return malloc( size ); |
773 | } | 773 | } |
774 | 774 | ||
775 | void operator delete[]( void* p ) | 775 | void operator delete[]( void* p ) |
776 | { | 776 | { |
777 | free( p ); | 777 | free( p ); |
778 | } | 778 | } |
779 | 779 | ||
780 | void operator delete[]( void* p, size_t /*size*/ ) | 780 | void operator delete[]( void* p, size_t /*size*/ ) |
781 | { | 781 | { |
782 | free( p ); | 782 | free( p ); |
783 | } | 783 | } |
784 | 784 | ||
785 | void operator delete( void* p ) | 785 | void operator delete( void* p ) |
786 | { | 786 | { |
787 | free( p ); | 787 | free( p ); |
788 | } | 788 | } |
789 | 789 | ||
790 | void operator delete( void* p, size_t /*size*/ ) | 790 | void operator delete( void* p, size_t /*size*/ ) |
791 | { | 791 | { |
792 | free( p ); | 792 | free( p ); |
793 | } | 793 | } |
794 | 794 | ||
795 | #endif | 795 | #endif |