summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
authormickeyl <mickeyl>2005-06-26 12:18:37 (UTC)
committer mickeyl <mickeyl>2005-06-26 12:18:37 (UTC)
commit53f924947144ddbb3e15d3bd1ddc877073c7ec7f (patch) (side-by-side diff)
tree501e5658099d63309fbf56fc7bd046c0a174a024 /library/qpeapplication.cpp
parentd5a2b0d5ca4daa11894c52f3599dab56205bef4c (diff)
downloadopie-53f924947144ddbb3e15d3bd1ddc877073c7ec7f.zip
opie-53f924947144ddbb3e15d3bd1ddc877073c7ec7f.tar.gz
opie-53f924947144ddbb3e15d3bd1ddc877073c7ec7f.tar.bz2
get the default gfx driver from QWS_DISPLAY instead of hardcoding
it to 'Transformed' when launching rotated apps. Patch courtesy Manuel Teira
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (show whitespace changes)
-rw-r--r--library/qpeapplication.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 0f3e4a4..19e99f2 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1243,97 +1243,100 @@ QString QPEApplication::qpeDir()
return dir;
}
/*!
Returns the user's current Document directory. There is a trailing "/".
.. well, it does now,, and there's no trailing '/'
*/
QString QPEApplication::documentDir()
{
const char* base = getenv( "HOME");
if ( base )
return QString( base ) + "/Documents";
return QString( "../Documents" );
}
static int deforient = -1;
/*!
\internal
*/
int QPEApplication::defaultRotation()
{
if ( deforient < 0 ) {
QString d = getenv( "QWS_DISPLAY" );
if ( d.contains( "Rot90" ) ) {
deforient = 90;
}
else if ( d.contains( "Rot180" ) ) {
deforient = 180;
}
else if ( d.contains( "Rot270" ) ) {
deforient = 270;
}
else {
deforient = 0;
}
}
return deforient;
}
/*!
\internal
*/
void QPEApplication::setDefaultRotation( int r )
{
if ( qApp->type() == GuiServer ) {
deforient = r;
- setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
+ int j = 0;
+ QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed";
+ QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() );
+ setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg(driver).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>
#if QT_VERSION > 236
extern void qws_clearLoadedFonts();
#endif
void QPEApplication::setCurrentMode( int x, int y, int depth )
{
// Reset the caches
#if QT_VERSION > 236
qws_clearLoadedFonts();
#endif
QPixmapCache::clear();
// Change the screen mode
qt_screen->setMode(x, y, depth);
if ( qApp->type() == GuiServer ) {
#if QT_VERSION > 236
// Reconfigure the GuiServer
qwsServer->beginDisplayReconfigure();
qwsServer->endDisplayReconfigure();
#endif
// Get all the running apps to reset
QCopEnvelope env( "QPE/System", "reset()" );
}
}
void QPEApplication::reset() {
// Reconnect to the screen
qt_screen->disconnect();
qt_screen->connect( QString::null );