author | zecke <zecke> | 2005-04-16 22:00:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-04-16 22:00:51 (UTC) |
commit | 632d3e87a7e2cf6efecb676987d622e937ecafb8 (patch) (unidiff) | |
tree | 6689c8549e494841108217daa21913ec27565720 /x11/libqpe-x11 | |
parent | 790b371e6c7ed9da76eafb8a5b2e5d5458b320d8 (diff) | |
download | opie-632d3e87a7e2cf6efecb676987d622e937ecafb8.zip opie-632d3e87a7e2cf6efecb676987d622e937ecafb8.tar.gz opie-632d3e87a7e2cf6efecb676987d622e937ecafb8.tar.bz2 |
Opie/X11:
Minor updates to build a recent Opie version for usage with
the X Window System
-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.cpp | 26 | ||||
-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.h | 8 | ||||
-rw-r--r-- | x11/libqpe-x11/qt/qwindowsystem_qws.h | 3 |
3 files changed, 26 insertions, 11 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp index 73e7ce4..c49f3ad 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.cpp +++ b/x11/libqpe-x11/qpe/qpeapplication.cpp | |||
@@ -394,99 +394,104 @@ void QPEApplication::applyStyle() { | |||
394 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 394 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
395 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 395 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
396 | color = config.readEntry( "Text", "#000000" ); | 396 | color = config.readEntry( "Text", "#000000" ); |
397 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 397 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
398 | color = config.readEntry( "ButtonText", "#000000" ); | 398 | color = config.readEntry( "ButtonText", "#000000" ); |
399 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 399 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
400 | color = config.readEntry( "Base", "#FFFFFF" ); | 400 | color = config.readEntry( "Base", "#FFFFFF" ); |
401 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 401 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
402 | 402 | ||
403 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 403 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
404 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 404 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
405 | 405 | ||
406 | setPalette( pal, TRUE ); | 406 | setPalette( pal, TRUE ); |
407 | 407 | ||
408 | 408 | ||
409 | 409 | ||
410 | // Font | 410 | // Font |
411 | QString ff = config.readEntry( "FontFamily", font().family() ); | 411 | QString ff = config.readEntry( "FontFamily", font().family() ); |
412 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 412 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
413 | setFont( QFont(ff, fs) ); | 413 | setFont( QFont(ff, fs) ); |
414 | } | 414 | } |
415 | int QPEApplication::defaultRotation() { | 415 | int QPEApplication::defaultRotation() { |
416 | return 0; | 416 | return 0; |
417 | } | 417 | } |
418 | void QPEApplication::setDefaultRotation(int r ) { | 418 | void QPEApplication::setDefaultRotation(int) { |
419 | 419 | ||
420 | } | 420 | } |
421 | void QPEApplication::grabKeyboard() { | 421 | void QPEApplication::grabKeyboard() { |
422 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; | 422 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; |
423 | if ( qApp->type() == QApplication::GuiServer ) | 423 | if ( qApp->type() == QApplication::GuiServer ) |
424 | d->kbgrabber = 0; | 424 | d->kbgrabber = 0; |
425 | else { | 425 | else { |
426 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); | 426 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); |
427 | e << d->appName; | 427 | e << d->appName; |
428 | 428 | ||
429 | d->kbgrabber = 2; // me | 429 | d->kbgrabber = 2; // me |
430 | } | 430 | } |
431 | } | 431 | } |
432 | void QPEApplication::ungrabKeyboard() { | 432 | void QPEApplication::ungrabKeyboard() { |
433 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; | 433 | QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; |
434 | if ( d->kbgrabber == 2 ) { | 434 | if ( d->kbgrabber == 2 ) { |
435 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); | 435 | QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); |
436 | e << QString::null; | 436 | e << QString::null; |
437 | 437 | ||
438 | d->kbregrab = FALSE; | 438 | d->kbregrab = FALSE; |
439 | d->kbgrabber = 0; | 439 | d->kbgrabber = 0; |
440 | } | 440 | } |
441 | } | 441 | } |
442 | void QPEApplication::showMainWidget( QWidget* wid, bool b) { | 442 | void QPEApplication::showMainWidget( QWidget* wid, bool b) { |
443 | d->show(wid, b ); | 443 | d->show(wid, b ); |
444 | } | 444 | } |
445 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) { | 445 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) { |
446 | if ( mw && argc() == 2 ) | 446 | if ( mw && argc() == 2 ) |
447 | Global::setDocument( mw, QString::fromUtf8(argv()[1] ) ); | 447 | Global::setDocument( mw, QString::fromUtf8(argv()[1] ) ); |
448 | 448 | ||
449 | d->show(mw, m ); | 449 | d->show(mw, m ); |
450 | } | 450 | } |
451 | void QPEApplication::showDialog( QDialog* d, bool nomax ) { | 451 | void QPEApplication::showDialog( QDialog* d, bool nomax ) { |
452 | showWidget( d, nomax ); | ||
453 | } | ||
454 | int QPEApplication::execDialog( QDialog* d, bool nomax) { | ||
455 | showDialog(d,nomax); | ||
456 | return d->exec(); | ||
457 | } | ||
458 | |||
459 | void QPEApplication::showWidget( QWidget* d, bool nomax ) { | ||
452 | QSize sh = d->sizeHint(); | 460 | QSize sh = d->sizeHint(); |
453 | int w = QMAX(sh.width(),d->width()); | 461 | int w = QMAX(sh.width(),d->width()); |
454 | int h = QMAX(sh.height(),d->height()); | 462 | int h = QMAX(sh.height(),d->height()); |
455 | if ( !nomax | 463 | if ( !nomax |
456 | && ( w > qApp->desktop()->width()*3/4 | 464 | && ( w > qApp->desktop()->width()*3/4 |
457 | || h > qApp->desktop()->height()*3/4 ) ) | 465 | || h > qApp->desktop()->height()*3/4 ) ) |
458 | { | 466 | { |
459 | d->showMaximized(); | 467 | d->showMaximized(); |
460 | } else { | 468 | } else { |
461 | d->resize(w,h); | 469 | d->resize(w,h); |
462 | d->show(); | 470 | d->show(); |
463 | } | 471 | } |
464 | } | 472 | } |
465 | int QPEApplication::execDialog( QDialog* d, bool nomax) { | 473 | |
466 | showDialog(d,nomax); | ||
467 | return d->exec(); | ||
468 | } | ||
469 | void QPEApplication::setKeepRunning() { | 474 | void QPEApplication::setKeepRunning() { |
470 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 475 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
471 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 476 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
472 | qpeApp->d->keep_running = TRUE; | 477 | qpeApp->d->keep_running = TRUE; |
473 | } | 478 | } |
474 | } | 479 | } |
475 | bool QPEApplication::keepRunning()const { | 480 | bool QPEApplication::keepRunning()const { |
476 | return d->keep_running; | 481 | return d->keep_running; |
477 | } | 482 | } |
478 | bool QPEApplication::keyboardGrabbed()const { | 483 | bool QPEApplication::keyboardGrabbed()const { |
479 | return d->kbgrabber; | 484 | return d->kbgrabber; |
480 | } | 485 | } |
481 | int QPEApplication::exec() { | 486 | int QPEApplication::exec() { |
482 | /* now send the QCOP stuff gotten from the file */ | 487 | /* now send the QCOP stuff gotten from the file */ |
483 | d->sendQCopQ(); | 488 | d->sendQCopQ(); |
484 | 489 | ||
485 | if ( d->keep_running ) { | 490 | if ( d->keep_running ) { |
486 | qWarning("going to exec"); | 491 | qWarning("going to exec"); |
487 | int a = QApplication::exec(); | 492 | int a = QApplication::exec(); |
488 | qWarning("left"); | 493 | qWarning("left"); |
489 | return a; | 494 | return a; |
490 | } | 495 | } |
491 | 496 | ||
492 | { | 497 | { |
@@ -736,61 +741,66 @@ int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) { | |||
736 | /* | 741 | /* |
737 | * I'm not sure if we should use activeWidget | 742 | * I'm not sure if we should use activeWidget |
738 | * or activeModalWidget | 743 | * or activeModalWidget |
739 | * a QDialog could be not modal too | 744 | * a QDialog could be not modal too |
740 | */ | 745 | */ |
741 | if ( w->inherits("QDialog" ) ) { | 746 | if ( w->inherits("QDialog" ) ) { |
742 | qWarning("inherits QDialog!!!"); | 747 | qWarning("inherits QDialog!!!"); |
743 | QDialog* dia = (QDialog*)w; | 748 | QDialog* dia = (QDialog*)w; |
744 | /* | 749 | /* |
745 | * call it directly or via QTimer::singleShot? | 750 | * call it directly or via QTimer::singleShot? |
746 | */ | 751 | */ |
747 | QTimer::singleShot(0, dia, SLOT(accept() ) ); | 752 | QTimer::singleShot(0, dia, SLOT(accept() ) ); |
748 | return 0; | 753 | return 0; |
749 | } | 754 | } |
750 | 755 | ||
751 | } | 756 | } |
752 | } | 757 | } |
753 | return QApplication::x11ClientMessage(w, event, b ); | 758 | return QApplication::x11ClientMessage(w, event, b ); |
754 | } | 759 | } |
755 | 760 | ||
756 | #define KeyPress XKeyPress | 761 | #define KeyPress XKeyPress |
757 | #define KeyRelease XKeyRelease | 762 | #define KeyRelease XKeyRelease |
758 | 763 | ||
759 | #if defined(OPIE_NEW_MALLOC) | 764 | #if defined(OPIE_NEW_MALLOC) |
765 | #define likely(x) x | ||
760 | 766 | ||
761 | // The libraries with the skiff package (and possibly others) have | 767 | // The libraries with the skiff package (and possibly others) have |
762 | // completely useless implementations of builtin new and delete that | 768 | // completely useless implementations of builtin new and delete that |
763 | // use about 50% of your CPU. Here we revert to the simple libc | 769 | // use about 50% of your CPU. Here we revert to the simple libc |
764 | // functions. | 770 | // functions. |
765 | 771 | ||
766 | void* operator new[]( size_t size ) | 772 | void* operator new[]( size_t size ) |
767 | { | 773 | { |
768 | return malloc( size ); | 774 | return malloc( size ); |
769 | } | 775 | } |
770 | 776 | ||
771 | void* operator new( size_t size ) | 777 | void* operator new( size_t size ) |
772 | { | 778 | { |
773 | return malloc( size ); | 779 | return malloc( size ); |
774 | } | 780 | } |
775 | 781 | ||
776 | void operator delete[]( void* p ) | 782 | void operator delete[]( void* p ) |
777 | { | 783 | { |
784 | if ( likely(p) ) | ||
778 | free( p ); | 785 | free( p ); |
779 | } | 786 | } |
780 | 787 | ||
781 | void operator delete[]( void* p, size_t /*size*/ ) | 788 | void operator delete[]( void* p, size_t /*size*/ ) |
782 | { | 789 | { |
790 | if ( likely(p) ) | ||
783 | free( p ); | 791 | free( p ); |
784 | } | 792 | } |
785 | 793 | ||
786 | void operator delete( void* p ) | 794 | void operator delete( void* p ) |
787 | { | 795 | { |
796 | if ( likely(p) ) | ||
788 | free( p ); | 797 | free( p ); |
789 | } | 798 | } |
790 | 799 | ||
791 | void operator delete( void* p, size_t /*size*/ ) | 800 | void operator delete( void* p, size_t /*size*/ ) |
792 | { | 801 | { |
802 | if ( likely(p) ) | ||
793 | free( p ); | 803 | free( p ); |
794 | } | 804 | } |
795 | 805 | ||
796 | #endif | 806 | #endif |
diff --git a/x11/libqpe-x11/qpe/qpeapplication.h b/x11/libqpe-x11/qpe/qpeapplication.h index b1fc074..5521998 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.h +++ b/x11/libqpe-x11/qpe/qpeapplication.h | |||
@@ -1,73 +1,75 @@ | |||
1 | #ifndef OPIE_QPE_APPLICATION_H | 1 | #ifndef OPIE_QPE_APPLICATION_H |
2 | #define OPIE_QPE_APPLICATION_H | 2 | #define OPIE_QPE_APPLICATION_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * LGPLed | 5 | * LGPLed |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <qapplication.h> | 8 | #include <qapplication.h> |
9 | #include <qevent.h> | 9 | #include <qevent.h> |
10 | 10 | #include <qtopia/timestring.h> | |
11 | #include <qpe/timestring.h> | 11 | #include <unistd.h> |
12 | #include <stdlib.h> | ||
12 | 13 | ||
13 | class QCopChannel; | 14 | class QCopChannel; |
14 | class QPEApplication : public QApplication { | 15 | class QPEApplication : public QApplication { |
15 | Q_OBJECT | 16 | Q_OBJECT |
16 | public: | 17 | public: |
17 | QPEApplication(int& argc, char** argv, Type=GuiClient ); | 18 | QPEApplication(int& argc, char** argv, Type=GuiClient ); |
18 | ~QPEApplication(); | 19 | ~QPEApplication(); |
19 | 20 | ||
20 | 21 | ||
21 | static QString qpeDir(); | 22 | static QString qpeDir(); |
22 | static QString documentDir(); | 23 | static QString documentDir(); |
23 | void applyStyle(); | 24 | void applyStyle(); |
24 | 25 | ||
25 | static int defaultRotation(); | 26 | static int defaultRotation(); |
26 | static void setDefaultRotation( int r ); | 27 | static void setDefaultRotation( int r ); |
27 | static void grabKeyboard(); | 28 | static void grabKeyboard(); |
28 | static void ungrabKeyboard(); | 29 | static void ungrabKeyboard(); |
29 | 30 | ||
30 | enum StylusMode { | 31 | enum StylusMode { |
31 | LeftOnly, | 32 | LeftOnly, |
32 | RightOnHold | 33 | RightOnHold |
33 | }; | 34 | }; |
34 | static void setStylusOperation( QWidget*, StylusMode ); | 35 | static void setStylusOperation( QWidget*, StylusMode ); |
35 | static StylusMode stylusOperation( QWidget* ); | 36 | static StylusMode stylusOperation( QWidget* ); |
36 | 37 | ||
37 | enum InputMethodHint { | 38 | enum InputMethodHint { |
38 | Normal, | 39 | Normal, |
39 | AlwaysOff, | 40 | AlwaysOff, |
40 | AlwaysOn | 41 | AlwaysOn |
41 | }; | 42 | }; |
42 | static void setInputMethodHint( QWidget*, InputMethodHint ); | 43 | static void setInputMethodHint( QWidget*, InputMethodHint ); |
43 | static InputMethodHint inputMethodHint( QWidget* ); | 44 | static InputMethodHint inputMethodHint( QWidget* ); |
44 | 45 | ||
45 | void showMainWidget( QWidget*, bool nomax = FALSE ); | 46 | void showMainWidget( QWidget*, bool nomax = FALSE ); |
46 | void showMainDocumentWidget( QWidget*, bool nomax = FALSE ); | 47 | void showMainDocumentWidget( QWidget*, bool nomax = FALSE ); |
47 | 48 | ||
48 | static void showDialog( QDialog*, bool nomax = FALSE ); | 49 | static void showDialog( QDialog*, bool nomax = FALSE ); |
49 | static int execDialog( QDialog*, bool nomax = FALSE ); | 50 | static int execDialog ( QDialog*, bool nomax = FALSE ); |
51 | static void showWidget( QWidget*, bool nomax = FALSE ); | ||
50 | 52 | ||
51 | static void setKeepRunning(); | 53 | static void setKeepRunning(); |
52 | bool keepRunning()const; | 54 | bool keepRunning()const; |
53 | 55 | ||
54 | bool keyboardGrabbed()const; | 56 | bool keyboardGrabbed()const; |
55 | int exec(); | 57 | int exec(); |
56 | 58 | ||
57 | // QWS bits | 59 | // QWS bits |
58 | enum screenSaverHint { | 60 | enum screenSaverHint { |
59 | Disable = 0, | 61 | Disable = 0, |
60 | DisableLightOff = 1, | 62 | DisableLightOff = 1, |
61 | DisableSuspend = 2, | 63 | DisableSuspend = 2, |
62 | Enable = 100 | 64 | Enable = 100 |
63 | }; | 65 | }; |
64 | /* reimplemented for internal purposes */ | 66 | /* reimplemented for internal purposes */ |
65 | int x11ClientMessage( QWidget*, XEvent*, bool ); | 67 | int x11ClientMessage( QWidget*, XEvent*, bool ); |
66 | 68 | ||
67 | signals: | 69 | signals: |
68 | void clientMoused(); | 70 | void clientMoused(); |
69 | void timeChanged(); | 71 | void timeChanged(); |
70 | void clockChanged( bool pm ); | 72 | void clockChanged( bool pm ); |
71 | void micChanged( bool muted ); | 73 | void micChanged( bool muted ); |
72 | void volumeChanged( bool muted ); | 74 | void volumeChanged( bool muted ); |
73 | void appMessage( const QCString& msg, const QByteArray& data); | 75 | void appMessage( const QCString& msg, const QByteArray& data); |
diff --git a/x11/libqpe-x11/qt/qwindowsystem_qws.h b/x11/libqpe-x11/qt/qwindowsystem_qws.h index 88902c8..42470cd 100644 --- a/x11/libqpe-x11/qt/qwindowsystem_qws.h +++ b/x11/libqpe-x11/qt/qwindowsystem_qws.h | |||
@@ -1,36 +1,39 @@ | |||
1 | #ifndef OPIE_QWINDOWSYSTEM_H | 1 | #ifndef OPIE_QWINDOWSYSTEM_H |
2 | #define OPIE_QWINDOWSYSTEM_H | 2 | #define OPIE_QWINDOWSYSTEM_H |
3 | 3 | ||
4 | #include <qimage.h> | 4 | #include <qimage.h> |
5 | 5 | ||
6 | class QWSScreenSaver; | 6 | class QWSScreenSaver; |
7 | class QWSServer { | 7 | class QWSServer { |
8 | public: | 8 | public: |
9 | QWSServer(){} | 9 | QWSServer(){} |
10 | ~QWSServer(){} | 10 | ~QWSServer(){} |
11 | static void sendKeyEvent(int, int, int, bool, bool ) { } | 11 | static void sendKeyEvent(int, int, int, bool, bool ) { } |
12 | struct KeyboardFilter { | 12 | struct KeyboardFilter { |
13 | bool filter(int,int,int,bool,bool) { | ||
14 | return false; | ||
15 | } | ||
13 | }; | 16 | }; |
14 | static void setKeyboardFilter( KeyboardFilter* ) { | 17 | static void setKeyboardFilter( KeyboardFilter* ) { |
15 | 18 | ||
16 | } | 19 | } |
17 | static void setScreenSaver( QWSScreenSaver* ) { | 20 | static void setScreenSaver( QWSScreenSaver* ) { |
18 | 21 | ||
19 | } | 22 | } |
20 | static void setScreenSaverInterval( int ) { | 23 | static void setScreenSaverInterval( int ) { |
21 | 24 | ||
22 | } | 25 | } |
23 | static void setScreenSaverIntervals( int[] ) { | 26 | static void setScreenSaverIntervals( int[] ) { |
24 | 27 | ||
25 | } | 28 | } |
26 | static void screenSaverActivate( bool ) { | 29 | static void screenSaverActivate( bool ) { |
27 | 30 | ||
28 | } | 31 | } |
29 | static void setDesktopBackground( const QImage& ) { | 32 | static void setDesktopBackground( const QImage& ) { |
30 | 33 | ||
31 | } | 34 | } |
32 | 35 | ||
33 | }; | 36 | }; |
34 | struct QWSScreenSaver { | 37 | struct QWSScreenSaver { |
35 | }; | 38 | }; |
36 | 39 | ||