summaryrefslogtreecommitdiff
path: root/library
Side-by-side diff
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/qpeapplication.cpp46
-rw-r--r--library/qpeapplication.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 149e6bb..71ec5b3 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1046,48 +1046,81 @@ int QPEApplication::defaultRotation()
}
/*!
\internal
*/
void QPEApplication::setDefaultRotation( int r )
{
if ( qApp->type() == GuiServer ) {
deforient = r;
setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
Config config("qpe");
config.setGroup( "Rotation" );
config.writeEntry( "Rot", r );
}
else {
#ifndef QT_NO_COP
{ QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
e << r;
}
#endif
}
}
+#include <qgfx_qws.h>
+#include <qwindowsystem_qws.h>
+#include <qpixmapcache.h>
+
+extern void qws_clearLoadedFonts();
+
+inline void QPEApplication::setCurrentMode( int x, int y, int depth )
+{
+ // Reset the caches
+ qws_clearLoadedFonts();
+ QPixmapCache::clear();
+
+ // Change the screen mode
+ qt_screen->setMode(x, y, depth);
+
+ if ( qApp->type() == GuiServer ) {
+ // Reconfigure the GuiServer
+ qwsServer->beginDisplayReconfigure();
+ qwsServer->endDisplayReconfigure();
+
+ // Get all the running apps to reset
+ QCopEnvelope env( "QPE/System", "reset()" );
+ }
+}
+
+inline void QPEApplication::reset() {
+ // Reconnect to the screen
+ qt_screen->disconnect();
+ qt_screen->connect( QString::null );
+
+ // Redraw everything
+ applyStyle();
+}
/*!
\internal
*/
void QPEApplication::applyStyle()
{
Config config( "qpe" );
config.setGroup( "Appearance" );
#if QT_VERSION > 233
// don't block ourselves ...
Opie::force_appearance = 0;
static QString appname = Opie::binaryName ( );
QStringList ex = config. readListEntry ( "NoStyle", ';' );
int nostyle = 0;
for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
break;
}
}
@@ -1159,48 +1192,61 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
if ( msg == "applyStyle()" ) {
applyStyle();
}
else if ( msg == "toggleApplicationMenu()" ) {
QWidget *active = activeWindow ( );
if ( active ) {
QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
bool oldactive = man-> isActive ( );
man-> setActive( !man-> isActive() );
if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
}
}
}
else if ( msg == "setDefaultRotation(int)" ) {
if ( type() == GuiServer ) {
int r;
stream >> r;
setDefaultRotation( r );
}
}
+ else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
+ if ( type() == GuiServer ) {
+ int x, y, depth;
+ stream >> x;
+ stream >> y;
+ stream >> depth;
+ setCurrentMode( x, y, depth );
+ }
+ }
+ else if ( msg == "reset()" ) {
+ if ( type() != GuiServer )
+ reset();
+ }
else if ( msg == "setCurrentRotation(int)" ) {
int r;
stream >> r;
setCurrentRotation( r );
}
else if ( msg == "shutdown()" ) {
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 == "language(QString)" ) {
if ( type() == GuiServer ) {
QString l;
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 343e0b9..42810e8 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -27,51 +27,53 @@
#include <qdialog.h>
#include <qwsdisplay_qws.h>
#if defined(_WS_QWS_) && !defined(Q_WS_QWS)
#define Q_WS_QWS
#endif
#include "qpedecoration_qws.h"
#include "timestring.h"
class QCopChannel;
class QPEApplicationData;
class QWSEvent;
class QWSKeyEvent;
class QPEApplication : public QApplication
{
Q_OBJECT
public:
QPEApplication( int& argc, char **argv, Type=GuiClient );
~QPEApplication();
static QString qpeDir();
static QString documentDir();
void applyStyle();
+ void reset();
static int defaultRotation();
static void setDefaultRotation(int r);
static void setCurrentRotation(int r);
+ static void setCurrentMode(int x, int y, int depth );
static void grabKeyboard();
static void ungrabKeyboard();
enum StylusMode {
LeftOnly,
RightOnHold
// RightOnHoldLeftDelayed, etc.
};
static void setStylusOperation( QWidget*, StylusMode );
static StylusMode stylusOperation( QWidget* );
enum InputMethodHint {
Normal,
AlwaysOff,
AlwaysOn
};
enum screenSaverHint {
Disable = 0,
DisableLightOff = 1,
DisableSuspend = 2,
Enable = 100
};