author | zecke <zecke> | 2003-08-29 18:04:43 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-29 18:04:43 (UTC) |
commit | 18cae99f1deb15213074a8fb96f79eae4b0c5a43 (patch) (unidiff) | |
tree | 1dc5c46deef1558b8cca0fd716c3a154c6eb6ac8 | |
parent | 885c645ee48ae53467e244521c011c73bc106afb (diff) | |
download | opie-18cae99f1deb15213074a8fb96f79eae4b0c5a43.zip opie-18cae99f1deb15213074a8fb96f79eae4b0c5a43.tar.gz opie-18cae99f1deb15213074a8fb96f79eae4b0c5a43.tar.bz2 |
Patch provided by mithro
I've included 2 patches need to make opie support on the fly screen
resolution changing. This is done with the following,
qcop "QPE/System" "setCurrentMode(int,int,int)" 480 640 16
This is good for running applications in compatibility mode on the C700.
As you can see there isn't much to these patches.
-rw-r--r-- | library/qpeapplication.cpp | 46 | ||||
-rw-r--r-- | library/qpeapplication.h | 2 |
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 | |||
@@ -1054,32 +1054,65 @@ void QPEApplication::setDefaultRotation( int r ) | |||
1054 | deforient = r; | 1054 | deforient = r; |
1055 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1055 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
1056 | Config config("qpe"); | 1056 | Config config("qpe"); |
1057 | config.setGroup( "Rotation" ); | 1057 | config.setGroup( "Rotation" ); |
1058 | config.writeEntry( "Rot", r ); | 1058 | config.writeEntry( "Rot", r ); |
1059 | } | 1059 | } |
1060 | else { | 1060 | else { |
1061 | #ifndef QT_NO_COP | 1061 | #ifndef QT_NO_COP |
1062 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1062 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1063 | e << r; | 1063 | e << r; |
1064 | } | 1064 | } |
1065 | #endif | 1065 | #endif |
1066 | 1066 | ||
1067 | } | 1067 | } |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | #include <qgfx_qws.h> | ||
1071 | #include <qwindowsystem_qws.h> | ||
1072 | #include <qpixmapcache.h> | ||
1073 | |||
1074 | extern void qws_clearLoadedFonts(); | ||
1075 | |||
1076 | inline void QPEApplication::setCurrentMode( int x, int y, int depth ) | ||
1077 | { | ||
1078 | // Reset the caches | ||
1079 | qws_clearLoadedFonts(); | ||
1080 | QPixmapCache::clear(); | ||
1081 | |||
1082 | // Change the screen mode | ||
1083 | qt_screen->setMode(x, y, depth); | ||
1084 | |||
1085 | if ( qApp->type() == GuiServer ) { | ||
1086 | // Reconfigure the GuiServer | ||
1087 | qwsServer->beginDisplayReconfigure(); | ||
1088 | qwsServer->endDisplayReconfigure(); | ||
1089 | |||
1090 | // Get all the running apps to reset | ||
1091 | QCopEnvelope env( "QPE/System", "reset()" ); | ||
1092 | } | ||
1093 | } | ||
1094 | |||
1095 | inline void QPEApplication::reset() { | ||
1096 | // Reconnect to the screen | ||
1097 | qt_screen->disconnect(); | ||
1098 | qt_screen->connect( QString::null ); | ||
1099 | |||
1100 | // Redraw everything | ||
1101 | applyStyle(); | ||
1102 | } | ||
1070 | 1103 | ||
1071 | /*! | 1104 | /*! |
1072 | \internal | 1105 | \internal |
1073 | */ | 1106 | */ |
1074 | void QPEApplication::applyStyle() | 1107 | void QPEApplication::applyStyle() |
1075 | { | 1108 | { |
1076 | Config config( "qpe" ); | 1109 | Config config( "qpe" ); |
1077 | config.setGroup( "Appearance" ); | 1110 | config.setGroup( "Appearance" ); |
1078 | 1111 | ||
1079 | #if QT_VERSION > 233 | 1112 | #if QT_VERSION > 233 |
1080 | // don't block ourselves ... | 1113 | // don't block ourselves ... |
1081 | Opie::force_appearance = 0; | 1114 | Opie::force_appearance = 0; |
1082 | 1115 | ||
1083 | static QString appname = Opie::binaryName ( ); | 1116 | static QString appname = Opie::binaryName ( ); |
1084 | 1117 | ||
1085 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 1118 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
@@ -1167,32 +1200,45 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data | |||
1167 | bool oldactive = man-> isActive ( ); | 1200 | bool oldactive = man-> isActive ( ); |
1168 | 1201 | ||
1169 | man-> setActive( !man-> isActive() ); | 1202 | man-> setActive( !man-> isActive() ); |
1170 | 1203 | ||
1171 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1204 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1172 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1205 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1173 | } | 1206 | } |
1174 | } | 1207 | } |
1175 | } | 1208 | } |
1176 | else if ( msg == "setDefaultRotation(int)" ) { | 1209 | else if ( msg == "setDefaultRotation(int)" ) { |
1177 | if ( type() == GuiServer ) { | 1210 | if ( type() == GuiServer ) { |
1178 | int r; | 1211 | int r; |
1179 | stream >> r; | 1212 | stream >> r; |
1180 | setDefaultRotation( r ); | 1213 | setDefaultRotation( r ); |
1181 | } | 1214 | } |
1182 | } | 1215 | } |
1216 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> | ||
1217 | if ( type() == GuiServer ) { | ||
1218 | int x, y, depth; | ||
1219 | stream >> x; | ||
1220 | stream >> y; | ||
1221 | stream >> depth; | ||
1222 | setCurrentMode( x, y, depth ); | ||
1223 | } | ||
1224 | } | ||
1225 | else if ( msg == "reset()" ) { | ||
1226 | if ( type() != GuiServer ) | ||
1227 | reset(); | ||
1228 | } | ||
1183 | else if ( msg == "setCurrentRotation(int)" ) { | 1229 | else if ( msg == "setCurrentRotation(int)" ) { |
1184 | int r; | 1230 | int r; |
1185 | stream >> r; | 1231 | stream >> r; |
1186 | setCurrentRotation( r ); | 1232 | setCurrentRotation( r ); |
1187 | } | 1233 | } |
1188 | else if ( msg == "shutdown()" ) { | 1234 | else if ( msg == "shutdown()" ) { |
1189 | if ( type() == GuiServer ) | 1235 | if ( type() == GuiServer ) |
1190 | shutdown(); | 1236 | shutdown(); |
1191 | } | 1237 | } |
1192 | else if ( msg == "quit()" ) { | 1238 | else if ( msg == "quit()" ) { |
1193 | if ( type() != GuiServer ) | 1239 | if ( type() != GuiServer ) |
1194 | tryQuit(); | 1240 | tryQuit(); |
1195 | } | 1241 | } |
1196 | else if ( msg == "forceQuit()" ) { | 1242 | else if ( msg == "forceQuit()" ) { |
1197 | if ( type() != GuiServer ) | 1243 | if ( type() != GuiServer ) |
1198 | quit(); | 1244 | quit(); |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 343e0b9..42810e8 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -35,35 +35,37 @@ | |||
35 | class QCopChannel; | 35 | class QCopChannel; |
36 | class QPEApplicationData; | 36 | class QPEApplicationData; |
37 | class QWSEvent; | 37 | class QWSEvent; |
38 | class QWSKeyEvent; | 38 | class QWSKeyEvent; |
39 | 39 | ||
40 | 40 | ||
41 | class QPEApplication : public QApplication | 41 | class QPEApplication : public QApplication |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | QPEApplication( int& argc, char **argv, Type=GuiClient ); | 45 | QPEApplication( int& argc, char **argv, Type=GuiClient ); |
46 | ~QPEApplication(); | 46 | ~QPEApplication(); |
47 | 47 | ||
48 | static QString qpeDir(); | 48 | static QString qpeDir(); |
49 | static QString documentDir(); | 49 | static QString documentDir(); |
50 | void applyStyle(); | 50 | void applyStyle(); |
51 | void reset(); | ||
51 | static int defaultRotation(); | 52 | static int defaultRotation(); |
52 | static void setDefaultRotation(int r); | 53 | static void setDefaultRotation(int r); |
53 | static void setCurrentRotation(int r); | 54 | static void setCurrentRotation(int r); |
55 | static void setCurrentMode(int x, int y, int depth ); | ||
54 | static void grabKeyboard(); | 56 | static void grabKeyboard(); |
55 | static void ungrabKeyboard(); | 57 | static void ungrabKeyboard(); |
56 | 58 | ||
57 | enum StylusMode { | 59 | enum StylusMode { |
58 | LeftOnly, | 60 | LeftOnly, |
59 | RightOnHold | 61 | RightOnHold |
60 | // RightOnHoldLeftDelayed, etc. | 62 | // RightOnHoldLeftDelayed, etc. |
61 | }; | 63 | }; |
62 | static void setStylusOperation( QWidget*, StylusMode ); | 64 | static void setStylusOperation( QWidget*, StylusMode ); |
63 | static StylusMode stylusOperation( QWidget* ); | 65 | static StylusMode stylusOperation( QWidget* ); |
64 | 66 | ||
65 | enum InputMethodHint { | 67 | enum InputMethodHint { |
66 | Normal, | 68 | Normal, |
67 | AlwaysOff, | 69 | AlwaysOff, |
68 | AlwaysOn | 70 | AlwaysOn |
69 | }; | 71 | }; |