summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
authorsandman <sandman>2002-12-17 00:20:01 (UTC)
committer sandman <sandman>2002-12-17 00:20:01 (UTC)
commit70090722d240bed8c390281e072c9bcfc5ba7782 (patch) (unidiff)
tree453b4715acff74889655877a491c6cc3791d5de0 /library/qpeapplication.cpp
parent79b94019014efe998b126219827f3050395beea7 (diff)
downloadopie-70090722d240bed8c390281e072c9bcfc5ba7782.zip
opie-70090722d240bed8c390281e072c9bcfc5ba7782.tar.gz
opie-70090722d240bed8c390281e072c9bcfc5ba7782.tar.bz2
small additions to support grabbing the buttons back from a crashed
application
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 852671a..b26933b 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -94,24 +94,25 @@ class QPEApplicationData
94public: 94public:
95 QPEApplicationData() : presstimer( 0 ), presswidget( 0 ), kbgrabber( 0 ), 95 QPEApplicationData() : presstimer( 0 ), presswidget( 0 ), kbgrabber( 0 ),
96 rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ), 96 rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ),
97 forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 ) 97 forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 )
98 98
99 { 99 {
100 qcopq.setAutoDelete( TRUE ); 100 qcopq.setAutoDelete( TRUE );
101 } 101 }
102 102
103 int presstimer; 103 int presstimer;
104 QWidget* presswidget; 104 QWidget* presswidget;
105 int kbgrabber; 105 int kbgrabber;
106 QString kbgrabber_appname;
106 QPoint presspos; 107 QPoint presspos;
107 108
108 bool rightpressed : 1; 109 bool rightpressed : 1;
109 bool kbregrab : 1; 110 bool kbregrab : 1;
110 bool notbusysent : 1; 111 bool notbusysent : 1;
111 bool preloaded : 1; 112 bool preloaded : 1;
112 bool forceshow : 1; 113 bool forceshow : 1;
113 bool nomaximize : 1; 114 bool nomaximize : 1;
114 bool keep_running : 1; 115 bool keep_running : 1;
115 116
116 QString appName; 117 QString appName;
117 struct QCopRec 118 struct QCopRec
@@ -1055,24 +1056,26 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
1055 if ( type() == GuiServer ) 1056 if ( type() == GuiServer )
1056 restart(); 1057 restart();
1057 } 1058 }
1058 else if ( msg == "grabKeyboard(QString)" ) { 1059 else if ( msg == "grabKeyboard(QString)" ) {
1059 QString who; 1060 QString who;
1060 stream >> who; 1061 stream >> who;
1061 if ( who.isEmpty() ) 1062 if ( who.isEmpty() )
1062 d->kbgrabber = 0; 1063 d->kbgrabber = 0;
1063 else if ( who != d->appName ) 1064 else if ( who != d->appName )
1064 d->kbgrabber = 1; 1065 d->kbgrabber = 1;
1065 else 1066 else
1066 d->kbgrabber = 2; 1067 d->kbgrabber = 2;
1068
1069 d-> kbgrabber_appname = who;
1067 } 1070 }
1068 else if ( msg == "language(QString)" ) { 1071 else if ( msg == "language(QString)" ) {
1069 if ( type() == GuiServer ) { 1072 if ( type() == GuiServer ) {
1070 QString l; 1073 QString l;
1071 stream >> l; 1074 stream >> l;
1072 QString cl = getenv( "LANG" ); 1075 QString cl = getenv( "LANG" );
1073 if ( cl != l ) { 1076 if ( cl != l ) {
1074 if ( l.isNull() ) 1077 if ( l.isNull() )
1075 unsetenv( "LANG" ); 1078 unsetenv( "LANG" );
1076 else 1079 else
1077 setenv( "LANG", l.latin1(), 1 ); 1080 setenv( "LANG", l.latin1(), 1 );
1078 restart(); 1081 restart();
@@ -1615,24 +1618,32 @@ void QPEApplication::removeSenderFromStylusDict()
1615 if ( d->presswidget == sender() ) 1618 if ( d->presswidget == sender() )
1616 d->presswidget = 0; 1619 d->presswidget = 0;
1617} 1620}
1618 1621
1619/*! 1622/*!
1620 \internal 1623 \internal
1621*/ 1624*/
1622bool QPEApplication::keyboardGrabbed() const 1625bool QPEApplication::keyboardGrabbed() const
1623{ 1626{
1624 return d->kbgrabber; 1627 return d->kbgrabber;
1625} 1628}
1626 1629
1630/*!
1631 \internal
1632*/
1633QString QPEApplication::keyboardGrabbedBy() const
1634{
1635 return d->kbgrabber_appname;
1636}
1637
1627 1638
1628/*! 1639/*!
1629 Reverses the effect of grabKeyboard(). This is called automatically 1640 Reverses the effect of grabKeyboard(). This is called automatically
1630 on program exit. 1641 on program exit.
1631*/ 1642*/
1632void QPEApplication::ungrabKeyboard() 1643void QPEApplication::ungrabKeyboard()
1633{ 1644{
1634 QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d; 1645 QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d;
1635 if ( d->kbgrabber == 2 ) { 1646 if ( d->kbgrabber == 2 ) {
1636#ifndef QT_NO_COP 1647#ifndef QT_NO_COP
1637 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); 1648 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
1638 e << QString::null; 1649 e << QString::null;