summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 4c93111..b5dff3a 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1425,322 +1425,319 @@ static void createDict()
1425*/ 1425*/
1426QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) 1426QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w )
1427{ 1427{
1428 if ( stylusDict ) 1428 if ( stylusDict )
1429 return ( StylusMode ) ( int ) stylusDict->find( w ); 1429 return ( StylusMode ) ( int ) stylusDict->find( w );
1430 return LeftOnly; 1430 return LeftOnly;
1431} 1431}
1432 1432
1433/*! 1433/*!
1434 \enum QPEApplication::StylusMode 1434 \enum QPEApplication::StylusMode
1435 1435
1436 \value LeftOnly the stylus only generates LeftButton 1436 \value LeftOnly the stylus only generates LeftButton
1437 events (the default). 1437 events (the default).
1438 \value RightOnHold the stylus generates RightButton events 1438 \value RightOnHold the stylus generates RightButton events
1439 if the user uses the press-and-hold gesture. 1439 if the user uses the press-and-hold gesture.
1440 1440
1441 \sa setStylusOperation() stylusOperation() 1441 \sa setStylusOperation() stylusOperation()
1442*/ 1442*/
1443 1443
1444/*! 1444/*!
1445 Causes widget \a w to receive mouse events according to the stylus 1445 Causes widget \a w to receive mouse events according to the stylus
1446 \a mode. 1446 \a mode.
1447 1447
1448 \sa stylusOperation() StylusMode 1448 \sa stylusOperation() StylusMode
1449*/ 1449*/
1450void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) 1450void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode )
1451{ 1451{
1452 createDict(); 1452 createDict();
1453 if ( mode == LeftOnly ) { 1453 if ( mode == LeftOnly ) {
1454 stylusDict->remove 1454 stylusDict->remove
1455 ( w ); 1455 ( w );
1456 w->removeEventFilter( qApp ); 1456 w->removeEventFilter( qApp );
1457 } 1457 }
1458 else { 1458 else {
1459 stylusDict->insert( w, ( void* ) mode ); 1459 stylusDict->insert( w, ( void* ) mode );
1460 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); 1460 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
1461 w->installEventFilter( qApp ); 1461 w->installEventFilter( qApp );
1462 } 1462 }
1463} 1463}
1464 1464
1465 1465
1466/*! 1466/*!
1467 \reimp 1467 \reimp
1468*/ 1468*/
1469bool QPEApplication::eventFilter( QObject *o, QEvent *e ) 1469bool QPEApplication::eventFilter( QObject *o, QEvent *e )
1470{ 1470{
1471 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { 1471 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
1472 QMouseEvent * me = ( QMouseEvent* ) e; 1472 QMouseEvent * me = ( QMouseEvent* ) e;
1473 StylusMode mode = (StylusMode)(int)stylusDict->find(o); 1473 StylusMode mode = (StylusMode)(int)stylusDict->find(o);
1474 switch (mode) { 1474 switch (mode) {
1475 case RightOnHold: 1475 case RightOnHold:
1476 switch ( me->type() ) { 1476 switch ( me->type() ) {
1477 case QEvent::MouseButtonPress: 1477 case QEvent::MouseButtonPress:
1478 if ( me->button() == LeftButton ) { 1478 if ( me->button() == LeftButton ) {
1479 d->presstimer = startTimer(500); // #### pref. 1479 d->presstimer = startTimer(500); // #### pref.
1480 d->presswidget = (QWidget*)o; 1480 d->presswidget = (QWidget*)o;
1481 d->presspos = me->pos(); 1481 d->presspos = me->pos();
1482 d->rightpressed = FALSE; 1482 d->rightpressed = FALSE;
1483 } 1483 }
1484 break; 1484 break;
1485 case QEvent::MouseMove: 1485 case QEvent::MouseMove:
1486 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 1486 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
1487 killTimer(d->presstimer); 1487 killTimer(d->presstimer);
1488 d->presstimer = 0; 1488 d->presstimer = 0;
1489 } 1489 }
1490 break; 1490 break;
1491 case QEvent::MouseButtonRelease: 1491 case QEvent::MouseButtonRelease:
1492 if ( me->button() == LeftButton ) { 1492 if ( me->button() == LeftButton ) {
1493 if ( d->presstimer ) { 1493 if ( d->presstimer ) {
1494 killTimer(d->presstimer); 1494 killTimer(d->presstimer);
1495 d->presstimer = 0; 1495 d->presstimer = 0;
1496 } 1496 }
1497 if ( d->rightpressed && d->presswidget ) { 1497 if ( d->rightpressed && d->presswidget ) {
1498 // Right released 1498 // Right released
1499 postEvent( d->presswidget, 1499 postEvent( d->presswidget,
1500 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 1500 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
1501 RightButton, LeftButton + RightButton ) ); 1501 RightButton, LeftButton + RightButton ) );
1502 // Left released, off-widget 1502 // Left released, off-widget
1503 postEvent( d->presswidget, 1503 postEvent( d->presswidget,
1504 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), 1504 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
1505 LeftButton, LeftButton ) ); 1505 LeftButton, LeftButton ) );
1506 postEvent( d->presswidget, 1506 postEvent( d->presswidget,
1507 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), 1507 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
1508 LeftButton, LeftButton ) ); 1508 LeftButton, LeftButton ) );
1509 d->rightpressed = FALSE; 1509 d->rightpressed = FALSE;
1510 return TRUE; // don't send the real Left release 1510 return TRUE; // don't send the real Left release
1511 } 1511 }
1512 } 1512 }
1513 break; 1513 break;
1514 default: 1514 default:
1515 break; 1515 break;
1516 } 1516 }
1517 break; 1517 break;
1518 default: 1518 default:
1519 ; 1519 ;
1520 } 1520 }
1521 } 1521 }
1522 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1522 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1523 QKeyEvent *ke = (QKeyEvent *)e; 1523 QKeyEvent *ke = (QKeyEvent *)e;
1524 if ( ke->key() == Key_Enter ) { 1524 if ( ke->key() == Key_Enter ) {
1525 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { 1525 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
1526 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', 1526 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
1527 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); 1527 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
1528 return TRUE; 1528 return TRUE;
1529 } 1529 }
1530 } 1530 }
1531 } 1531 }
1532 return FALSE; 1532 return FALSE;
1533} 1533}
1534 1534
1535/*! 1535/*!
1536 \reimp 1536 \reimp
1537*/ 1537*/
1538void QPEApplication::timerEvent( QTimerEvent *e ) 1538void QPEApplication::timerEvent( QTimerEvent *e )
1539{ 1539{
1540 if ( e->timerId() == d->presstimer && d->presswidget ) { 1540 if ( e->timerId() == d->presstimer && d->presswidget ) {
1541 // Right pressed 1541 // Right pressed
1542 postEvent( d->presswidget, 1542 postEvent( d->presswidget,
1543 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 1543 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
1544 RightButton, LeftButton ) ); 1544 RightButton, LeftButton ) );
1545 killTimer( d->presstimer ); 1545 killTimer( d->presstimer );
1546 d->presstimer = 0; 1546 d->presstimer = 0;
1547 d->rightpressed = TRUE; 1547 d->rightpressed = TRUE;
1548 } 1548 }
1549} 1549}
1550 1550
1551void QPEApplication::removeSenderFromStylusDict() 1551void QPEApplication::removeSenderFromStylusDict()
1552{ 1552{
1553 stylusDict->remove 1553 stylusDict->remove
1554 ( ( void* ) sender() ); 1554 ( ( void* ) sender() );
1555 if ( d->presswidget == sender() ) 1555 if ( d->presswidget == sender() )
1556 d->presswidget = 0; 1556 d->presswidget = 0;
1557} 1557}
1558 1558
1559/*! 1559/*!
1560 \internal 1560 \internal
1561*/ 1561*/
1562bool QPEApplication::keyboardGrabbed() const 1562bool QPEApplication::keyboardGrabbed() const
1563{ 1563{
1564 return d->kbgrabber; 1564 return d->kbgrabber;
1565} 1565}
1566 1566
1567 1567
1568/*! 1568/*!
1569 Reverses the effect of grabKeyboard(). This is called automatically 1569 Reverses the effect of grabKeyboard(). This is called automatically
1570 on program exit. 1570 on program exit.
1571*/ 1571*/
1572void QPEApplication::ungrabKeyboard() 1572void QPEApplication::ungrabKeyboard()
1573{ 1573{
1574 QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d; 1574 QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d;
1575 if ( d->kbgrabber == 2 ) { 1575 if ( d->kbgrabber == 2 ) {
1576#ifndef QT_NO_COP 1576#ifndef QT_NO_COP
1577 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); 1577 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
1578 e << QString::null; 1578 e << QString::null;
1579#endif 1579#endif
1580 1580
1581 d->kbregrab = FALSE; 1581 d->kbregrab = FALSE;
1582 d->kbgrabber = 0; 1582 d->kbgrabber = 0;
1583 } 1583 }
1584} 1584}
1585 1585
1586/*! 1586/*!
1587 Grabs the physical keyboard keys, e.g. the application's launching 1587 Grabs the physical keyboard keys, e.g. the application's launching
1588 keys. Instead of launching applications when these keys are pressed 1588 keys. Instead of launching applications when these keys are pressed
1589 the signals emitted are sent to this application instead. Some games 1589 the signals emitted are sent to this application instead. Some games
1590 programs take over the launch keys in this way to make interaction 1590 programs take over the launch keys in this way to make interaction
1591 easier. 1591 easier.
1592 1592
1593 \sa ungrabKeyboard() 1593 \sa ungrabKeyboard()
1594*/ 1594*/
1595void QPEApplication::grabKeyboard() 1595void QPEApplication::grabKeyboard()
1596{ 1596{
1597 QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d; 1597 QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d;
1598 if ( qApp->type() == QApplication::GuiServer ) 1598 if ( qApp->type() == QApplication::GuiServer )
1599 d->kbgrabber = 0; 1599 d->kbgrabber = 0;
1600 else { 1600 else {
1601#ifndef QT_NO_COP 1601#ifndef QT_NO_COP
1602 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); 1602 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
1603 e << d->appName; 1603 e << d->appName;
1604#endif 1604#endif
1605 1605
1606 d->kbgrabber = 2; // me 1606 d->kbgrabber = 2; // me
1607 } 1607 }
1608} 1608}
1609 1609
1610/*! 1610/*!
1611 \reimp 1611 \reimp
1612*/ 1612*/
1613int QPEApplication::exec() 1613int QPEApplication::exec()
1614{ 1614{
1615#ifndef QT_NO_COP 1615#ifndef QT_NO_COP
1616 d->sendQCopQ(); 1616 d->sendQCopQ();
1617#endif 1617#endif
1618 1618
1619 if ( d->keep_running ) 1619 if ( d->keep_running )
1620 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) 1620 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() )
1621 return QApplication::exec(); 1621 return QApplication::exec();
1622 1622
1623#ifndef QT_NO_COP 1623#ifndef QT_NO_COP
1624 1624
1625 { 1625 {
1626 QCopEnvelope e( "QPE/System", "closing(QString)" ); 1626 QCopEnvelope e( "QPE/System", "closing(QString)" );
1627 e << d->appName; 1627 e << d->appName;
1628 } 1628 }
1629#endif 1629#endif
1630 processEvents(); 1630 processEvents();
1631 return 0; 1631 return 0;
1632} 1632}
1633 1633
1634/*! 1634/*!
1635 \internal 1635 \internal
1636 External request for application to quit. Quits if possible without 1636 External request for application to quit. Quits if possible without
1637 loosing state. 1637 loosing state.
1638*/ 1638*/
1639void QPEApplication::tryQuit() 1639void QPEApplication::tryQuit()
1640{ 1640{
1641 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) 1641 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
1642 return ; // Inside modal loop or konsole. Too hard to save state. 1642 return ; // Inside modal loop or konsole. Too hard to save state.
1643#ifndef QT_NO_COP 1643#ifndef QT_NO_COP
1644 1644
1645 { 1645 {
1646 QCopEnvelope e( "QPE/System", "closing(QString)" ); 1646 QCopEnvelope e( "QPE/System", "closing(QString)" );
1647 e << d->appName; 1647 e << d->appName;
1648 } 1648 }
1649#endif 1649#endif
1650 processEvents(); 1650 processEvents();
1651 1651
1652 quit(); 1652 quit();
1653} 1653}
1654 1654
1655/*! 1655/*!
1656 \internal 1656 \internal
1657 User initiated quit. Makes the window 'Go Away'. If preloaded this means 1657 User initiated quit. Makes the window 'Go Away'. If preloaded this means
1658 hiding the window. If not it means quitting the application. 1658 hiding the window. If not it means quitting the application.
1659 As this is user initiated we don't need to check state. 1659 As this is user initiated we don't need to check state.
1660*/ 1660*/
1661void QPEApplication::hideOrQuit() 1661void QPEApplication::hideOrQuit()
1662{ 1662{
1663 processEvents(); 1663 processEvents();
1664 1664
1665 // If we are a preloaded application we don't actually quit, so emit 1665 // If we are a preloaded application we don't actually quit, so emit
1666 // a System message indicating we're quasi-closing. 1666 // a System message indicating we're quasi-closing.
1667 if ( d->preloaded && d->qpe_main_widget ) 1667 if ( d->preloaded && d->qpe_main_widget )
1668#ifndef QT_NO_COP 1668#ifndef QT_NO_COP
1669 1669
1670 { 1670 {
1671 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); 1671 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
1672 e << d->appName; 1672 e << d->appName;
1673 d->qpe_main_widget->hide(); 1673 d->qpe_main_widget->hide();
1674 } 1674 }
1675#endif 1675#endif
1676 else 1676 else
1677 quit(); 1677 quit();
1678} 1678}
1679 1679
1680 1680
1681// These 6 stubs below need 1.5K in the binary and besides that -
1682// we are not using ancient toolchains anymore - sandman
1683
1684#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SHARP) 1681#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SHARP)
1685 1682
1686// The libraries with the skiff package (and possibly others) have 1683// The libraries with the skiff package (and possibly others) have
1687// completely useless implementations of builtin new and delete that 1684// completely useless implementations of builtin new and delete that
1688// use about 50% of your CPU. Here we revert to the simple libc 1685// use about 50% of your CPU. Here we revert to the simple libc
1689// functions. 1686// functions.
1690 1687
1691void* operator new[]( size_t size ) 1688void* operator new[]( size_t size )
1692{ 1689{
1693 return malloc( size ); 1690 return malloc( size );
1694} 1691}
1695 1692
1696void* operator new( size_t size ) 1693void* operator new( size_t size )
1697{ 1694{
1698 return malloc( size ); 1695 return malloc( size );
1699} 1696}
1700 1697
1701void operator delete[]( void* p ) 1698void operator delete[]( void* p )
1702{ 1699{
1703 free( p ); 1700 free( p );
1704} 1701}
1705 1702
1706void operator delete[]( void* p, size_t /*size*/ ) 1703void operator delete[]( void* p, size_t /*size*/ )
1707{ 1704{
1708 free( p ); 1705 free( p );
1709} 1706}
1710 1707
1711void operator delete( void* p ) 1708void operator delete( void* p )
1712{ 1709{
1713 free( p ); 1710 free( p );
1714} 1711}
1715 1712
1716void operator delete( void* p, size_t /*size*/ ) 1713void operator delete( void* p, size_t /*size*/ )
1717{ 1714{
1718 free( p ); 1715 free( p );
1719} 1716}
1720 1717
1721#endif 1718#endif
1722 1719
1723#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) 1720#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP)
1724#include <qwidgetlist.h> 1721#include <qwidgetlist.h>
1725#ifdef QWS 1722#ifdef QWS
1726#include <qgfx_qws.h> 1723#include <qgfx_qws.h>
1727extern QRect qt_maxWindowRect; 1724extern QRect qt_maxWindowRect;
1728void qt_setMaxWindowRect(const QRect& r ) 1725void qt_setMaxWindowRect(const QRect& r )
1729{ 1726{
1730 qt_maxWindowRect = qt_screen->mapFromDevice( r, 1727 qt_maxWindowRect = qt_screen->mapFromDevice( r,
1731 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); 1728 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) );
1732 // Re-resize any maximized windows 1729 // Re-resize any maximized windows
1733 QWidgetList* l = QApplication::topLevelWidgets(); 1730 QWidgetList* l = QApplication::topLevelWidgets();
1734 if ( l ) { 1731 if ( l ) {
1735 QWidget * w = l->first(); 1732 QWidget * w = l->first();
1736 while ( w ) { 1733 while ( w ) {
1737 if ( w->isVisible() && w->isMaximized() ) { 1734 if ( w->isVisible() && w->isMaximized() ) {
1738 w->showMaximized(); 1735 w->showMaximized();
1739 } 1736 }
1740 w = l->next(); 1737 w = l->next();
1741 } 1738 }
1742 delete l; 1739 delete l;
1743 } 1740 }
1744} 1741}
1745#endif 1742#endif
1746#endif 1743#endif