summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
Side-by-side diff
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
@@ -82,48 +82,49 @@
#include "imagecodecinterface.h"
#include <unistd.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include "qt_override_p.h"
class QPEApplicationData
{
public:
QPEApplicationData() : presstimer( 0 ), presswidget( 0 ), kbgrabber( 0 ),
rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), preloaded( FALSE ),
forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), qpe_main_widget( 0 )
{
qcopq.setAutoDelete( TRUE );
}
int presstimer;
QWidget* presswidget;
int kbgrabber;
+ QString kbgrabber_appname;
QPoint presspos;
bool rightpressed : 1;
bool kbregrab : 1;
bool notbusysent : 1;
bool preloaded : 1;
bool forceshow : 1;
bool nomaximize : 1;
bool keep_running : 1;
QString appName;
struct QCopRec
{
QCopRec( const QCString &ch, const QCString &msg,
const QByteArray &d ) :
channel( ch ), message( msg ), data( d )
{ }
QCString channel;
QCString message;
QByteArray data;
};
QWidget* qpe_main_widget;
QList<QCopRec> qcopq;
@@ -1043,48 +1044,50 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
if ( type() == GuiServer )
shutdown();
}
else if ( msg == "quit()" ) {
if ( type() != GuiServer )
tryQuit();
}
else if ( msg == "forceQuit()" ) {
if ( type() != GuiServer )
quit();
}
else if ( msg == "restart()" ) {
if ( type() == GuiServer )
restart();
}
else if ( msg == "grabKeyboard(QString)" ) {
QString who;
stream >> who;
if ( who.isEmpty() )
d->kbgrabber = 0;
else if ( who != d->appName )
d->kbgrabber = 1;
else
d->kbgrabber = 2;
+
+ d-> kbgrabber_appname = who;
}
else if ( msg == "language(QString)" ) {
if ( type() == GuiServer ) {
QString l;
stream >> l;
QString cl = getenv( "LANG" );
if ( cl != l ) {
if ( l.isNull() )
unsetenv( "LANG" );
else
setenv( "LANG", l.latin1(), 1 );
restart();
}
}
}
else if ( msg == "timeChange(QString)" ) {
QString t;
stream >> t;
if ( t.isNull() )
unsetenv( "TZ" );
else
setenv( "TZ", t.latin1(), 1 );
// emit the signal so everyone else knows...
emit timeChanged();
@@ -1603,48 +1606,56 @@ void QPEApplication::timerEvent( QTimerEvent *e )
new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
RightButton, LeftButton ) );
killTimer( d->presstimer );
d->presstimer = 0;
d->rightpressed = TRUE;
}
}
void QPEApplication::removeSenderFromStylusDict()
{
stylusDict->remove
( ( void* ) sender() );
if ( d->presswidget == sender() )
d->presswidget = 0;
}
/*!
\internal
*/
bool QPEApplication::keyboardGrabbed() const
{
return d->kbgrabber;
}
+/*!
+ \internal
+*/
+QString QPEApplication::keyboardGrabbedBy() const
+{
+ return d->kbgrabber_appname;
+}
+
/*!
Reverses the effect of grabKeyboard(). This is called automatically
on program exit.
*/
void QPEApplication::ungrabKeyboard()
{
QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d;
if ( d->kbgrabber == 2 ) {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
e << QString::null;
#endif
d->kbregrab = FALSE;
d->kbgrabber = 0;
}
}
/*!
Grabs the physical keyboard keys, e.g. the application's launching
keys. Instead of launching applications when these keys are pressed
the signals emitted are sent to this application instead. Some games
programs take over the launch keys in this way to make interaction