author | mickeyl <mickeyl> | 2005-06-26 12:18:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-26 12:18:37 (UTC) |
commit | 53f924947144ddbb3e15d3bd1ddc877073c7ec7f (patch) (side-by-side diff) | |
tree | 501e5658099d63309fbf56fc7bd046c0a174a024 | |
parent | d5a2b0d5ca4daa11894c52f3599dab56205bef4c (diff) | |
download | opie-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
-rw-r--r-- | library/applnk.cpp | 6 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 5 | ||||
-rw-r--r-- | library/qpeapplication.h | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index c82d3b9..874a1b6 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp @@ -664,51 +664,53 @@ AppLnk::~AppLnk() /*! \overload Executes the application associated with this AppLnk. \sa exec() */ void AppLnk::execute() const { execute( QStringList::split( ' ', property( "Arguments" ) ) ); } /*! Executes the application associated with this AppLnk, with \a args as arguments. \sa exec() */ void AppLnk::execute(const QStringList& args) const { #ifdef Q_WS_QWS if ( !mRotation.isEmpty() ) { // ######## this will only work in the server int rot = QPEApplication::defaultRotation(); + int j = 0; rot = (rot+mRotation.toInt())%360; - QCString old = getenv("QWS_DISPLAY"); - setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); + 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( rot ), 1 ); invoke(args); setenv("QWS_DISPLAY", old.data(), 1); } else #endif invoke(args); } /*! Invokes the application associated with this AppLnk, with \a args as arguments. Rotation is not taken into account by this function, so you should not call it directly. \sa execute() */ void AppLnk::invoke(const QStringList& args) const { if ( property( "Arguments" ).isEmpty() ) Global::execute( exec(), args[0] ); else Global::execute( exec(), args.join( " " ) ); } /*! Sets the Exec property to \a exec. diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 0f3e4a4..19e99f2 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -1267,49 +1267,52 @@ int QPEApplication::defaultRotation() 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 diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 167fe69..cff3e43 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h @@ -187,49 +187,52 @@ enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws inline int TransToDeg ( Transformation t ) { int d = static_cast<int>( t ); return d * 90; } inline Transformation DegToTrans ( int d ) { Transformation t = static_cast<Transformation>( d / 90 ); return t; } /* * Set current rotation of Opie, and rotation for newly started apps. * Differs from setDefaultRotation in that 1) it rotates currently running apps, * and 2) does not set deforient or save orientation to qpe.conf. */ inline void QPEApplication::setCurrentRotation( int r ) { // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots // for compatibility with the SharpROM use fallback to setDefaultTransformation() #if QT_VERSION > 233 Transformation e = DegToTrans( r ); - ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); + QCString old = getenv("QWS_DISPLAY") ? getenv( "QWS_DISPLAY" ) : "Transformed"; + int j = 0; + 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 ); qApp->desktop()->qwsDisplay()->setTransformation( e ); #else setDefaultRotation( r ); #endif } /* * Qtopia 1.7 SDK compatibility macros * FIXME: Support Opie Quicklaunch Interface */ #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ int main( int argc, char** argv ) \ { \ QPEApplication app = QPEApplication( argc, argv ); \ IMPLEMENTATION* mw = new IMPLEMENTATION(); \ app.showMainWidget( mw ); \ app.exec(); \ } #define QTOPIA_MAIN // Bee-Bop-Alula /* * -remove me */ #ifdef Q_WS_QWS |