summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2005-09-27 21:04:59 (UTC)
committer zecke <zecke>2005-09-27 21:04:59 (UTC)
commit061e4461d8916dfaa20d80a998341a222da9aa64 (patch) (unidiff)
tree5ac9af92bdf97c16fc7dd5797d434d82276e0fb3 /library
parent04166623e424201b134fd090869b316fa7935ed0 (diff)
downloadopie-061e4461d8916dfaa20d80a998341a222da9aa64.zip
opie-061e4461d8916dfaa20d80a998341a222da9aa64.tar.gz
opie-061e4461d8916dfaa20d80a998341a222da9aa64.tar.bz2
Mac OS X compile fixes:
-disable the "fuege alle libs auf verdacht hinzu" hack and hope we will identify the root cause. -do not redefine cxa_... on Mac. At least the the Apple Linker is not happy with having that symbol defined twice. -well DYLD_BOOL could not be casted to bool. changing it to bool works -opiecore.pro use the same test as in include.pro to see if we build on linux
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qlibrary_unix.cpp2
-rw-r--r--library/qpeapplication.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp
index 2181153..fee73c2 100644
--- a/library/qlibrary_unix.cpp
+++ b/library/qlibrary_unix.cpp
@@ -60,184 +60,184 @@ bool QLibraryPrivate::freeLibrary()
60 } 60 }
61 return FALSE; 61 return FALSE;
62} 62}
63 63
64void* QLibraryPrivate::resolveSymbol( const char* symbol ) 64void* QLibraryPrivate::resolveSymbol( const char* symbol )
65{ 65{
66 if ( !pHnd ) 66 if ( !pHnd )
67 return 0; 67 return 0;
68 68
69 void* address = 0; 69 void* address = 0;
70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) { 70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) {
71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
72 qDebug( "Couldn't resolve symbol \"%s\"", symbol ); 72 qDebug( "Couldn't resolve symbol \"%s\"", symbol );
73#endif 73#endif
74 return 0; 74 return 0;
75 } 75 }
76 return address; 76 return address;
77} 77}
78 78
79#elif defined(_NULL_LIB_) 79#elif defined(_NULL_LIB_)
80 80
81bool QLibraryPrivate::loadLibrary() 81bool QLibraryPrivate::loadLibrary()
82{ 82{
83 //qDebug("QLibraryPrivate::loadLibrary\n"); 83 //qDebug("QLibraryPrivate::loadLibrary\n");
84 return FALSE; 84 return FALSE;
85} 85}
86bool QLibraryPrivate::freeLibrary() 86bool QLibraryPrivate::freeLibrary()
87{ 87{
88 //qDebug("QLibraryPrivate::freeLibrary\n"); 88 //qDebug("QLibraryPrivate::freeLibrary\n");
89 return FALSE; 89 return FALSE;
90} 90}
91void* QLibraryPrivate::resolveSymbol( const char* symbol ) 91void* QLibraryPrivate::resolveSymbol( const char* symbol )
92{ 92{
93 //qDebug("QLibraryPrivate::resolveSymbol\n"); 93 //qDebug("QLibraryPrivate::resolveSymbol\n");
94 return FALSE; 94 return FALSE;
95} 95}
96 96
97#elif defined(Q_OS_MACX) 97#elif defined(Q_OS_MACX)
98 98
99#define ENUM_DYLD_BOOL 99#define ENUM_DYLD_BOOL
100enum DYLD_BOOL { 100enum DYLD_BOOL {
101 DYLD_FALSE, 101 DYLD_FALSE,
102 DYLD_TRUE 102 DYLD_TRUE
103}; 103};
104#include <mach-o/dyld.h> 104#include <mach-o/dyld.h>
105typedef struct { 105typedef struct {
106 NSObjectFileImage img; 106 NSObjectFileImage img;
107 NSModule mod; 107 NSModule mod;
108} DyldLibDesc; 108} DyldLibDesc;
109 109
110bool QLibraryPrivate::loadLibrary() 110bool QLibraryPrivate::loadLibrary()
111{ 111{
112 // qDebug("QLibraryPrivate::loadLibrary\n"); 112 // qDebug("QLibraryPrivate::loadLibrary\n");
113 // return FALSE; 113 // return FALSE;
114 if ( pHnd ) 114 if ( pHnd )
115 return TRUE; 115 return TRUE;
116 116
117 QString filename = library->library(); 117 QString filename = library->library();
118 118
119 NSObjectFileImage img = 0; 119 NSObjectFileImage img = 0;
120 NSModule mod = 0; 120 NSModule mod = 0;
121 NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img ); 121 NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img );
122 if ( ret != NSObjectFileImageSuccess ) { 122 if ( ret != NSObjectFileImageSuccess ) {
123 qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() ); 123 qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() );
124 if (ret == NSObjectFileImageAccess) { 124 if (ret == NSObjectFileImageAccess) {
125 qWarning ("(NSObjectFileImageAccess)" ); 125 qWarning ("(NSObjectFileImageAccess)" );
126 } 126 }
127 } else { 127 } else {
128 mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW | 128 mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW |
129 NSLINKMODULE_OPTION_PRIVATE | 129 NSLINKMODULE_OPTION_PRIVATE |
130 NSLINKMODULE_OPTION_RETURN_ON_ERROR); 130 NSLINKMODULE_OPTION_RETURN_ON_ERROR);
131 if (mod == 0) { 131 if (mod == 0) {
132 qWarning( "Error in NSLinkModule()" ); 132 qWarning( "Error in NSLinkModule()" );
133 NSDestroyObjectFileImage(img); 133 NSDestroyObjectFileImage(img);
134 } 134 }
135 } 135 }
136 DyldLibDesc* desc = 0; 136 DyldLibDesc* desc = 0;
137 if (img != 0 && mod != 0) { 137 if (img != 0 && mod != 0) {
138 desc = new DyldLibDesc; 138 desc = new DyldLibDesc;
139 desc->img = img; 139 desc->img = img;
140 desc->mod = mod; 140 desc->mod = mod;
141 } 141 }
142 pHnd = desc; 142 pHnd = desc;
143 return pHnd != 0; 143 return pHnd != 0;
144} 144}
145 145
146bool QLibraryPrivate::freeLibrary() 146bool QLibraryPrivate::freeLibrary()
147{ 147{
148 //qDebug("QLibraryPrivate::freeLibrary\n"); 148 //qDebug("QLibraryPrivate::freeLibrary\n");
149 //return FALSE; 149 //return FALSE;
150 if ( !pHnd ) 150 if ( !pHnd )
151 return TRUE; 151 return TRUE;
152 152
153 DyldLibDesc* desc = (DyldLibDesc*) pHnd; 153 DyldLibDesc* desc = (DyldLibDesc*) pHnd;
154 NSModule mod = desc->mod; 154 NSModule mod = desc->mod;
155 NSObjectFileImage img = desc->img; 155 NSObjectFileImage img = desc->img;
156 DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE); 156 bool success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE);
157 if ( success ) { 157 if ( success ) {
158 NSDestroyObjectFileImage(img); 158 NSDestroyObjectFileImage(img);
159 delete desc; 159 delete desc;
160 pHnd = 0; 160 pHnd = 0;
161 } 161 }
162#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 162#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
163 else { 163 else {
164 qWarning( "Error in NSUnLinkModule()" ); 164 qWarning( "Error in NSUnLinkModule()" );
165 } 165 }
166#endif 166#endif
167 return pHnd == 0; 167 return pHnd == 0;
168} 168}
169 169
170void* QLibraryPrivate::resolveSymbol( const char* symbol ) 170void* QLibraryPrivate::resolveSymbol( const char* symbol )
171{ 171{
172 //qDebug("QLibraryPrivate::resolveSymbol\n"); 172 //qDebug("QLibraryPrivate::resolveSymbol\n");
173 //return FALSE; 173 //return FALSE;
174 if ( !pHnd ) 174 if ( !pHnd )
175 return 0; 175 return 0;
176 176
177 DyldLibDesc* desc = (DyldLibDesc*) pHnd; 177 DyldLibDesc* desc = (DyldLibDesc*) pHnd;
178 NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol); 178 NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol);
179 void* address = 0; 179 void* address = 0;
180 if (sym != 0) { 180 if (sym != 0) {
181 address = NSAddressOfSymbol(sym); 181 address = NSAddressOfSymbol(sym);
182 } 182 }
183#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 183#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
184 if ( address == 0 ) 184 if ( address == 0 )
185 qWarning( "Cannot find symbol: %s", symbol ); 185 qWarning( "Cannot find symbol: %s", symbol );
186#endif 186#endif
187 return address; 187 return address;
188} 188}
189 189
190#else 190#else
191// Something else, assuming POSIX 191// Something else, assuming POSIX
192#include <dlfcn.h> 192#include <dlfcn.h>
193 193
194bool QLibraryPrivate::loadLibrary() 194bool QLibraryPrivate::loadLibrary()
195{ 195{
196 if ( pHnd ) 196 if ( pHnd )
197 return TRUE; 197 return TRUE;
198 198
199 QString filename = library->library(); 199 QString filename = library->library();
200 200
201 pHnd = dlopen( filename.latin1() , RTLD_LAZY ); 201 pHnd = dlopen( filename.latin1() , RTLD_LAZY );
202// #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 202// #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
203 if ( !pHnd ) 203 if ( !pHnd )
204 qWarning( "%s", dlerror() ); 204 qWarning( "%s", dlerror() );
205// #endif 205// #endif
206 return pHnd != 0; 206 return pHnd != 0;
207} 207}
208 208
209bool QLibraryPrivate::freeLibrary() 209bool QLibraryPrivate::freeLibrary()
210{ 210{
211 if ( !pHnd ) 211 if ( !pHnd )
212 return TRUE; 212 return TRUE;
213 213
214 int ec = dlclose( pHnd ); 214 int ec = dlclose( pHnd );
215 if ( !ec ) 215 if ( !ec )
216 pHnd = 0; 216 pHnd = 0;
217#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 217#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
218 else { 218 else {
219 const char* error = dlerror(); 219 const char* error = dlerror();
220 if ( error ) 220 if ( error )
221 qWarning( "%s", error ); 221 qWarning( "%s", error );
222 } 222 }
223#endif 223#endif
224 return pHnd == 0; 224 return pHnd == 0;
225} 225}
226 226
227void* QLibraryPrivate::resolveSymbol( const char* f ) 227void* QLibraryPrivate::resolveSymbol( const char* f )
228{ 228{
229 if ( !pHnd ) 229 if ( !pHnd )
230 return 0; 230 return 0;
231 231
232 void* address = dlsym( pHnd, f ); 232 void* address = dlsym( pHnd, f );
233#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 233#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
234 const char* error = dlerror(); 234 const char* error = dlerror();
235 if ( error ) 235 if ( error )
236 qWarning( "%s", error ); 236 qWarning( "%s", error );
237#endif 237#endif
238 return address; 238 return address;
239} 239}
240 240
241#endif // POSIX 241#endif // POSIX
242 242
243#endif // QT_NO_COMPONENT 243#endif // QT_NO_COMPONENT
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 19e99f2..dcc1001 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -2114,177 +2114,177 @@ void QPEApplication::ungrabKeyboard()
2114{ 2114{
2115 ((QPEApplication *) qApp )-> d-> kbgrabbed = false; 2115 ((QPEApplication *) qApp )-> d-> kbgrabbed = false;
2116} 2116}
2117 2117
2118/*! 2118/*!
2119 Grabs the physical keyboard keys, e.g. the application's launching 2119 Grabs the physical keyboard keys, e.g. the application's launching
2120 keys. Instead of launching applications when these keys are pressed 2120 keys. Instead of launching applications when these keys are pressed
2121 the signals emitted are sent to this application instead. Some games 2121 the signals emitted are sent to this application instead. Some games
2122 programs take over the launch keys in this way to make interaction 2122 programs take over the launch keys in this way to make interaction
2123 easier. 2123 easier.
2124 2124
2125 \sa ungrabKeyboard() 2125 \sa ungrabKeyboard()
2126*/ 2126*/
2127void QPEApplication::grabKeyboard() 2127void QPEApplication::grabKeyboard()
2128{ 2128{
2129 ((QPEApplication *) qApp )-> d-> kbgrabbed = true; 2129 ((QPEApplication *) qApp )-> d-> kbgrabbed = true;
2130} 2130}
2131 2131
2132/*! 2132/*!
2133 \reimp 2133 \reimp
2134*/ 2134*/
2135int QPEApplication::exec() 2135int QPEApplication::exec()
2136{ 2136{
2137 d->qcopQok = true; 2137 d->qcopQok = true;
2138#ifndef QT_NO_COP 2138#ifndef QT_NO_COP
2139 d->sendQCopQ(); 2139 d->sendQCopQ();
2140 if ( !d->keep_running ) 2140 if ( !d->keep_running )
2141 processEvents(); // we may have received QCop messages in the meantime. 2141 processEvents(); // we may have received QCop messages in the meantime.
2142#endif 2142#endif
2143 2143
2144 if ( d->keep_running ) 2144 if ( d->keep_running )
2145 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) 2145 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() )
2146 return QApplication::exec(); 2146 return QApplication::exec();
2147 2147
2148#ifndef QT_NO_COP 2148#ifndef QT_NO_COP
2149 2149
2150 { 2150 {
2151 QCopEnvelope e( "QPE/System", "closing(QString)" ); 2151 QCopEnvelope e( "QPE/System", "closing(QString)" );
2152 e << d->appName; 2152 e << d->appName;
2153 } 2153 }
2154#endif 2154#endif
2155 processEvents(); 2155 processEvents();
2156 return 0; 2156 return 0;
2157} 2157}
2158 2158
2159/*! 2159/*!
2160 \internal 2160 \internal
2161 External request for application to quit. Quits if possible without 2161 External request for application to quit. Quits if possible without
2162 loosing state. 2162 loosing state.
2163*/ 2163*/
2164void QPEApplication::tryQuit() 2164void QPEApplication::tryQuit()
2165{ 2165{
2166 if ( activeModalWidget() ) 2166 if ( activeModalWidget() )
2167 return ; // Inside modal loop or konsole. Too hard to save state. 2167 return ; // Inside modal loop or konsole. Too hard to save state.
2168#ifndef QT_NO_COP 2168#ifndef QT_NO_COP
2169 2169
2170 { 2170 {
2171 QCopEnvelope e( "QPE/System", "closing(QString)" ); 2171 QCopEnvelope e( "QPE/System", "closing(QString)" );
2172 e << d->appName; 2172 e << d->appName;
2173 } 2173 }
2174#endif 2174#endif
2175 if ( d->keep_running ) 2175 if ( d->keep_running )
2176 d->store_widget_rect(d->qpe_main_widget, d->appName); 2176 d->store_widget_rect(d->qpe_main_widget, d->appName);
2177 processEvents(); 2177 processEvents();
2178 2178
2179 quit(); 2179 quit();
2180} 2180}
2181 2181
2182 2182
2183/*! 2183/*!
2184 \internal 2184 \internal
2185 User initiated quit. Makes the window 'Go Away'. If preloaded this means 2185 User initiated quit. Makes the window 'Go Away'. If preloaded this means
2186 hiding the window. If not it means quitting the application. 2186 hiding the window. If not it means quitting the application.
2187 As this is user initiated we don't need to check state. 2187 As this is user initiated we don't need to check state.
2188*/ 2188*/
2189void QPEApplication::hideOrQuit() 2189void QPEApplication::hideOrQuit()
2190{ 2190{
2191 if ( d->keep_running ) 2191 if ( d->keep_running )
2192 d->store_widget_rect(d->qpe_main_widget, d->appName); 2192 d->store_widget_rect(d->qpe_main_widget, d->appName);
2193 processEvents(); 2193 processEvents();
2194 2194
2195 // If we are a preloaded application we don't actually quit, so emit 2195 // If we are a preloaded application we don't actually quit, so emit
2196 // a System message indicating we're quasi-closing. 2196 // a System message indicating we're quasi-closing.
2197 if ( d->preloaded && d->qpe_main_widget ) 2197 if ( d->preloaded && d->qpe_main_widget )
2198#ifndef QT_NO_COP 2198#ifndef QT_NO_COP
2199 2199
2200 { 2200 {
2201 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); 2201 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
2202 e << d->appName; 2202 e << d->appName;
2203 d->qpe_main_widget->hide(); 2203 d->qpe_main_widget->hide();
2204 } 2204 }
2205#endif 2205#endif
2206 else 2206 else
2207 quit(); 2207 quit();
2208} 2208}
2209 2209
2210#if (__GNUC__ > 2 ) 2210#if (__GNUC__ > 2 ) && !defined(_OS_MACX_)
2211extern "C" void __cxa_pure_virtual(); 2211extern "C" void __cxa_pure_virtual();
2212 2212
2213void __cxa_pure_virtual() 2213void __cxa_pure_virtual()
2214{ 2214{
2215 fprintf( stderr, "Pure virtual called\n"); 2215 fprintf( stderr, "Pure virtual called\n");
2216 abort(); 2216 abort();
2217 2217
2218} 2218}
2219 2219
2220#endif 2220#endif
2221 2221
2222 2222
2223#if defined(OPIE_NEW_MALLOC) 2223#if defined(OPIE_NEW_MALLOC)
2224 2224
2225// The libraries with the skiff package (and possibly others) have 2225// The libraries with the skiff package (and possibly others) have
2226// completely useless implementations of builtin new and delete that 2226// completely useless implementations of builtin new and delete that
2227// use about 50% of your CPU. Here we revert to the simple libc 2227// use about 50% of your CPU. Here we revert to the simple libc
2228// functions. 2228// functions.
2229 2229
2230void* operator new[]( size_t size ) 2230void* operator new[]( size_t size )
2231{ 2231{
2232 return malloc( size ); 2232 return malloc( size );
2233} 2233}
2234 2234
2235void* operator new( size_t size ) 2235void* operator new( size_t size )
2236{ 2236{
2237 return malloc( size ); 2237 return malloc( size );
2238} 2238}
2239 2239
2240void operator delete[]( void* p ) 2240void operator delete[]( void* p )
2241{ 2241{
2242 if ( p ) 2242 if ( p )
2243 free( p ); 2243 free( p );
2244} 2244}
2245 2245
2246void operator delete[]( void* p, size_t /*size*/ ) 2246void operator delete[]( void* p, size_t /*size*/ )
2247{ 2247{
2248 if ( p ) 2248 if ( p )
2249 free( p ); 2249 free( p );
2250} 2250}
2251 2251
2252 2252
2253void operator delete( void* p ) 2253void operator delete( void* p )
2254{ 2254{
2255 if ( p ) 2255 if ( p )
2256 free( p ); 2256 free( p );
2257} 2257}
2258 2258
2259void operator delete( void* p, size_t /*size*/ ) 2259void operator delete( void* p, size_t /*size*/ )
2260{ 2260{
2261 if ( p ) 2261 if ( p )
2262 free( p ); 2262 free( p );
2263} 2263}
2264 2264
2265#endif 2265#endif
2266 2266
2267#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) 2267#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP)
2268#include <qwidgetlist.h> 2268#include <qwidgetlist.h>
2269#ifdef QWS 2269#ifdef QWS
2270#include <qgfx_qws.h> 2270#include <qgfx_qws.h>
2271extern QRect qt_maxWindowRect; 2271extern QRect qt_maxWindowRect;
2272void qt_setMaxWindowRect(const QRect& r ) 2272void qt_setMaxWindowRect(const QRect& r )
2273{ 2273{
2274 qt_maxWindowRect = qt_screen->mapFromDevice( r, 2274 qt_maxWindowRect = qt_screen->mapFromDevice( r,
2275 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); 2275 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) );
2276 // Re-resize any maximized windows 2276 // Re-resize any maximized windows
2277 QWidgetList* l = QApplication::topLevelWidgets(); 2277 QWidgetList* l = QApplication::topLevelWidgets();
2278 if ( l ) { 2278 if ( l ) {
2279 QWidget * w = l->first(); 2279 QWidget * w = l->first();
2280 while ( w ) { 2280 while ( w ) {
2281 if ( w->isVisible() && w->isMaximized() ) { 2281 if ( w->isVisible() && w->isMaximized() ) {
2282 w->showMaximized(); 2282 w->showMaximized();
2283 } 2283 }
2284 w = l->next(); 2284 w = l->next();
2285 } 2285 }
2286 delete l; 2286 delete l;
2287 } 2287 }
2288} 2288}
2289#endif 2289#endif
2290#endif 2290#endif