summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-06-26 12:18:37 (UTC)
committer mickeyl <mickeyl>2005-06-26 12:18:37 (UTC)
commit53f924947144ddbb3e15d3bd1ddc877073c7ec7f (patch) (unidiff)
tree501e5658099d63309fbf56fc7bd046c0a174a024
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 (more/less context) (show whitespace changes)
-rw-r--r--library/applnk.cpp6
-rw-r--r--library/qpeapplication.cpp5
-rw-r--r--library/qpeapplication.h5
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()
664 664
665/*! 665/*!
666 \overload 666 \overload
667 Executes the application associated with this AppLnk. 667 Executes the application associated with this AppLnk.
668 668
669 \sa exec() 669 \sa exec()
670*/ 670*/
671void AppLnk::execute() const 671void AppLnk::execute() const
672{ 672{
673 execute( QStringList::split( ' ', property( "Arguments" ) ) ); 673 execute( QStringList::split( ' ', property( "Arguments" ) ) );
674} 674}
675 675
676/*! 676/*!
677 Executes the application associated with this AppLnk, with 677 Executes the application associated with this AppLnk, with
678 \a args as arguments. 678 \a args as arguments.
679 679
680 \sa exec() 680 \sa exec()
681*/ 681*/
682void AppLnk::execute(const QStringList& args) const 682void AppLnk::execute(const QStringList& args) const
683{ 683{
684#ifdef Q_WS_QWS 684#ifdef Q_WS_QWS
685 if ( !mRotation.isEmpty() ) { 685 if ( !mRotation.isEmpty() ) {
686 // ######## this will only work in the server 686 // ######## this will only work in the server
687 int rot = QPEApplication::defaultRotation(); 687 int rot = QPEApplication::defaultRotation();
688 int j = 0;
688 rot = (rot+mRotation.toInt())%360; 689 rot = (rot+mRotation.toInt())%360;
689 QCString old = getenv("QWS_DISPLAY"); 690 QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed";
690 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); 691 QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() );
692 setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( rot ), 1 );
691 invoke(args); 693 invoke(args);
692 setenv("QWS_DISPLAY", old.data(), 1); 694 setenv("QWS_DISPLAY", old.data(), 1);
693 } else 695 } else
694#endif 696#endif
695 invoke(args); 697 invoke(args);
696} 698}
697 699
698/*! 700/*!
699 Invokes the application associated with this AppLnk, with 701 Invokes the application associated with this AppLnk, with
700 \a args as arguments. Rotation is not taken into account by 702 \a args as arguments. Rotation is not taken into account by
701 this function, so you should not call it directly. 703 this function, so you should not call it directly.
702 704
703 \sa execute() 705 \sa execute()
704*/ 706*/
705void AppLnk::invoke(const QStringList& args) const 707void AppLnk::invoke(const QStringList& args) const
706{ 708{
707 if ( property( "Arguments" ).isEmpty() ) 709 if ( property( "Arguments" ).isEmpty() )
708 Global::execute( exec(), args[0] ); 710 Global::execute( exec(), args[0] );
709 else 711 else
710 Global::execute( exec(), args.join( " " ) ); 712 Global::execute( exec(), args.join( " " ) );
711} 713}
712 714
713/*! 715/*!
714 Sets the Exec property to \a exec. 716 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()
1267 QString d = getenv( "QWS_DISPLAY" ); 1267 QString d = getenv( "QWS_DISPLAY" );
1268 if ( d.contains( "Rot90" ) ) { 1268 if ( d.contains( "Rot90" ) ) {
1269 deforient = 90; 1269 deforient = 90;
1270 } 1270 }
1271 else if ( d.contains( "Rot180" ) ) { 1271 else if ( d.contains( "Rot180" ) ) {
1272 deforient = 180; 1272 deforient = 180;
1273 } 1273 }
1274 else if ( d.contains( "Rot270" ) ) { 1274 else if ( d.contains( "Rot270" ) ) {
1275 deforient = 270; 1275 deforient = 270;
1276 } 1276 }
1277 else { 1277 else {
1278 deforient = 0; 1278 deforient = 0;
1279 } 1279 }
1280 } 1280 }
1281 return deforient; 1281 return deforient;
1282} 1282}
1283 1283
1284/*! 1284/*!
1285 \internal 1285 \internal
1286*/ 1286*/
1287void QPEApplication::setDefaultRotation( int r ) 1287void QPEApplication::setDefaultRotation( int r )
1288{ 1288{
1289 if ( qApp->type() == GuiServer ) { 1289 if ( qApp->type() == GuiServer ) {
1290 deforient = r; 1290 deforient = r;
1291 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1291 int j = 0;
1292 QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed";
1293 QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() );
1294 setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg(driver).arg( r ).latin1(), 1 );
1292 Config config("qpe"); 1295 Config config("qpe");
1293 config.setGroup( "Rotation" ); 1296 config.setGroup( "Rotation" );
1294 config.writeEntry( "Rot", r ); 1297 config.writeEntry( "Rot", r );
1295 } 1298 }
1296 else { 1299 else {
1297#ifndef QT_NO_COP 1300#ifndef QT_NO_COP
1298 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1301 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1299 e << r; 1302 e << r;
1300 } 1303 }
1301#endif 1304#endif
1302 1305
1303 } 1306 }
1304} 1307}
1305 1308
1306#include <qgfx_qws.h> 1309#include <qgfx_qws.h>
1307#include <qwindowsystem_qws.h> 1310#include <qwindowsystem_qws.h>
1308 1311
1309#if QT_VERSION > 236 1312#if QT_VERSION > 236
1310extern void qws_clearLoadedFonts(); 1313extern void qws_clearLoadedFonts();
1311#endif 1314#endif
1312 1315
1313void QPEApplication::setCurrentMode( int x, int y, int depth ) 1316void QPEApplication::setCurrentMode( int x, int y, int depth )
1314{ 1317{
1315 // Reset the caches 1318 // 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
187inline int TransToDeg ( Transformation t ) 187inline int TransToDeg ( Transformation t )
188{ 188{
189 int d = static_cast<int>( t ); 189 int d = static_cast<int>( t );
190 return d * 90; 190 return d * 90;
191} 191}
192 192
193inline Transformation DegToTrans ( int d ) 193inline Transformation DegToTrans ( int d )
194{ 194{
195 Transformation t = static_cast<Transformation>( d / 90 ); 195 Transformation t = static_cast<Transformation>( d / 90 );
196 return t; 196 return t;
197} 197}
198 198
199/* 199/*
200 * Set current rotation of Opie, and rotation for newly started apps. 200 * Set current rotation of Opie, and rotation for newly started apps.
201 * Differs from setDefaultRotation in that 1) it rotates currently running apps, 201 * Differs from setDefaultRotation in that 1) it rotates currently running apps,
202 * and 2) does not set deforient or save orientation to qpe.conf. 202 * and 2) does not set deforient or save orientation to qpe.conf.
203 */ 203 */
204 204
205inline void QPEApplication::setCurrentRotation( int r ) 205inline void QPEApplication::setCurrentRotation( int r )
206{ 206{
207 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots 207 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots
208 // for compatibility with the SharpROM use fallback to setDefaultTransformation() 208 // for compatibility with the SharpROM use fallback to setDefaultTransformation()
209#if QT_VERSION > 233 209#if QT_VERSION > 233
210 Transformation e = DegToTrans( r ); 210 Transformation e = DegToTrans( r );
211 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 211 QCString old = getenv("QWS_DISPLAY") ? getenv( "QWS_DISPLAY" ) : "Transformed";
212 int j = 0;
213 QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() );
214 ::setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( r ).latin1(), 1 );
212 qApp->desktop()->qwsDisplay()->setTransformation( e ); 215 qApp->desktop()->qwsDisplay()->setTransformation( e );
213#else 216#else
214 setDefaultRotation( r ); 217 setDefaultRotation( r );
215#endif 218#endif
216} 219}
217 220
218/* 221/*
219 * Qtopia 1.7 SDK compatibility macros 222 * Qtopia 1.7 SDK compatibility macros
220 * FIXME: Support Opie Quicklaunch Interface 223 * FIXME: Support Opie Quicklaunch Interface
221 */ 224 */
222 #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ 225 #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \
223 int main( int argc, char** argv ) \ 226 int main( int argc, char** argv ) \
224 { \ 227 { \
225 QPEApplication app = QPEApplication( argc, argv );\ 228 QPEApplication app = QPEApplication( argc, argv );\
226 IMPLEMENTATION* mw = new IMPLEMENTATION(); \ 229 IMPLEMENTATION* mw = new IMPLEMENTATION(); \
227 app.showMainWidget( mw ); \ 230 app.showMainWidget( mw ); \
228 app.exec(); \ 231 app.exec(); \
229 } 232 }
230#define QTOPIA_MAIN // Bee-Bop-Alula 233#define QTOPIA_MAIN // Bee-Bop-Alula
231 234
232/* 235/*
233 * -remove me 236 * -remove me
234 */ 237 */
235#ifdef Q_WS_QWS 238#ifdef Q_WS_QWS