qt4_genode.patch From: Christian Prochaska --- include/QtCore/qconfig.h | 2 - .../JavaScriptCore/runtime/Collector.cpp | 21 +++++++ .../JavaScriptCore/wtf/FastMalloc.cpp | 2 - .../javascriptcore/JavaScriptCore/wtf/Platform.h | 19 +++++- .../JavaScriptCore/wtf/TCSystemAlloc.cpp | 21 +++++++ src/3rdparty/webkit/Source/JavaScriptCore/config.h | 2 - .../Source/JavaScriptCore/wtf/FastMalloc.cpp | 4 + .../webkit/Source/JavaScriptCore/wtf/Platform.h | 25 +++++++- .../Source/JavaScriptCore/wtf/StackBounds.cpp | 12 ++++ .../Source/JavaScriptCore/wtf/TCSystemAlloc.cpp | 21 +++++++ .../Source/WebCore/generated/JSDOMWindow.cpp | 4 + .../Source/WebCore/generated/JSWorkerContext.cpp | 4 + .../webkit/Source/WebCore/loader/icon/IconRecord.h | 2 - src/3rdparty/webkit/Source/WebCore/page/Page.h | 2 - .../platform/network/ResourceResponseBase.h | 2 - src/corelib/codecs/qtextcodec.cpp | 2 - src/corelib/global/qglobal.cpp | 6 ++ src/corelib/global/qglobal.h | 5 +- src/corelib/io/qprocess.cpp | 63 ++++++++++++++++++++ src/corelib/io/qprocess_p.h | 45 ++++++++++++++ src/corelib/io/qresource.cpp | 2 - src/corelib/kernel/qcoreapplication.cpp | 10 +++ src/corelib/kernel/qtranslator.cpp | 2 - src/corelib/plugin/qpluginloader.cpp | 43 ++++++++++++- src/corelib/plugin/qpluginloader.h | 13 +++- src/corelib/thread/qmutex_p.h | 10 +++ src/corelib/thread/qthread.cpp | 5 ++ src/corelib/thread/qthread_p.h | 56 +++++++++++++++++- src/corelib/tools/qdatetime.cpp | 12 ++++ src/gui/dialogs/qfiledialog.cpp | 2 - src/gui/embedded/qscreendriverfactory_qws.cpp | 14 ++++ src/gui/embedded/qwindowsystem_qws.cpp | 9 +++ src/gui/image/qpnghandler.cpp | 33 +++++++--- src/gui/image/qxpmhandler.cpp | 8 +++ src/gui/kernel/qapplication.cpp | 64 ++++++++++++++++++-- src/gui/kernel/qapplication_qws.cpp | 14 ++++ src/gui/kernel/qeventdispatcher_qws.cpp | 20 ++++++ src/gui/kernel/qeventdispatcher_qws_p.h | 12 ++++ src/gui/text/qfontdatabase_qws.cpp | 37 ++++++++++++ src/gui/text/qfontengine_qws.cpp | 25 ++++++++ src/network/access/qnetworkaccessfilebackend.cpp | 5 ++ src/network/kernel/qhostinfo_unix.cpp | 7 ++ tools/designer/src/lib/uilib/formbuilder.cpp | 5 +- tools/designer/src/uitools/quiloader.cpp | 3 + 44 files changed, 618 insertions(+), 57 deletions(-) diff --git a/include/QtCore/qconfig.h b/include/QtCore/qconfig.h index aa8a3d6..1c65764 100644 --- a/include/QtCore/qconfig.h +++ b/include/QtCore/qconfig.h @@ -1 +1 @@ -#include "../../src/corelib/global/qconfig.h" +#include "../../../src/corelib/global/qconfig.h" diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp index 6af1784..2f3b102 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp @@ -62,6 +62,13 @@ #include +#elif OS(GENODE) + +#include +#include +#include +#include + #elif OS(UNIX) #include @@ -204,6 +211,15 @@ NEVER_INLINE CollectorBlock* Heap::allocateBlock() void* address = _aligned_malloc(BLOCK_SIZE, BLOCK_SIZE); #endif memset(address, 0, BLOCK_SIZE); +#elif OS(GENODE) + void* real_address = malloc(sizeof(Genode::addr_t) + BLOCK_SIZE + BLOCK_SIZE); + Genode::addr_t address = reinterpret_cast(real_address); + address += sizeof(Genode::addr_t); + address = Genode::align_addr(address, Genode::log2(BLOCK_SIZE)); + address -= sizeof(Genode::addr_t); + *(Genode::addr_t*)address = (Genode::addr_t)real_address; + address += sizeof(Genode::addr_t); + memset(reinterpret_cast(address), 0, BLOCK_SIZE); #elif HAVE(POSIX_MEMALIGN) void* address; posix_memalign(&address, BLOCK_SIZE, BLOCK_SIZE); @@ -294,6 +310,9 @@ NEVER_INLINE void Heap::freeBlockPtr(CollectorBlock* block) #else _aligned_free(block); #endif +#elif OS(GENODE) + void *real_address = (void*)*(Genode::addr_t*)((Genode::addr_t)block - sizeof(Genode::addr_t)); + free(real_address); #elif HAVE(POSIX_MEMALIGN) free(block); #else @@ -644,6 +663,8 @@ static inline void* currentThreadStackBase() thread_info threadInfo; get_thread_info(find_thread(NULL), &threadInfo); return threadInfo.stack_end; +#elif OS(GENODE) + return Genode::Thread_qt::myself()->stack_top(); #elif OS(UNIX) AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); MutexLocker locker(mutex); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp index d95f078..6aa56b6 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp @@ -97,7 +97,7 @@ // Use a background thread to periodically scavenge memory to release back to the system // https://bugs.webkit.org/show_bug.cgi?id=27900: don't turn this on for Tiger until we have figured out why it caused a crash. -#if defined(BUILDING_ON_TIGER) +#if defined(BUILDING_ON_TIGER) || OS(GENODE) #define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 0 #else #define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1 diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h index e95ac7f..19ad5e2 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h @@ -454,6 +454,13 @@ #define WTF_OS_UNIX 1 #endif +/* OS(GENODE) */ +/* Operating system level dependencies for Genode that should */ +/* be used regardless of operating environment */ +#ifdef __GENODE__ +#define WTF_OS_GENODE 1 +#endif + /* Operating environments */ /* FIXME: these are all mixes of OS, operating environment and policy choices. */ @@ -698,13 +705,13 @@ #endif #endif /* !defined(HAVE_ACCESSIBILITY) */ -#if OS(UNIX) && !OS(SYMBIAN) +#if OS(UNIX) && !OS(SYMBIAN) && !OS(GENODE) #define HAVE_SIGNAL_H 1 #endif #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \ && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \ - && !OS(ANDROID) && !OS(AIX) && !OS(HPUX) + && !OS(ANDROID) && !OS(AIX) && !OS(HPUX) && !OS(GENODE) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 @@ -779,6 +786,12 @@ #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_TIME_H 1 +#elif OS(GENODE) + +#define HAVE_MMAP 0 +#define HAVE_SBRK 0 +#define HAVE_SYS_TIME_H 1 + #else /* FIXME: is this actually used or do other platforms generate their own config.h? */ @@ -929,7 +942,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1 -#elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100 +#elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100 && !OS(GENODE) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 #elif CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100 diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp index ff2ac2b..370c600 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp @@ -56,6 +56,12 @@ #include #endif +#if OS(GENODE) +#include +#include +#include +#endif + #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif @@ -379,6 +385,21 @@ void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size, size_t alignment) { } #endif +#if OS(GENODE) + if (actual_size) + *actual_size = size; + + void* real_address = malloc(sizeof(Genode::addr_t) + size + alignment); + Genode::addr_t address = reinterpret_cast(real_address); + address += sizeof(Genode::addr_t); + address = Genode::align_addr(address, Genode::log2(alignment)); + address -= sizeof(Genode::addr_t); + *(Genode::addr_t*)address = (Genode::addr_t)real_address; + address += sizeof(Genode::addr_t); + + return (void*)address;; +#endif + // nothing worked - reset failure flags and try again devmem_failure = false; sbrk_failure = false; diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/config.h b/src/3rdparty/webkit/Source/JavaScriptCore/config.h index 394bba5..805b01d 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/config.h +++ b/src/3rdparty/webkit/Source/JavaScriptCore/config.h @@ -80,7 +80,7 @@ #endif -#if OS(UNIX) || OS(WINDOWS) +#if (OS(UNIX) || OS(WINDOWS)) && !OS(GENODE) #define WTF_USE_OS_RANDOMNESS 1 #endif diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp index 86b123d..fdeb5c9 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp +++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/FastMalloc.cpp @@ -97,7 +97,11 @@ #endif // Use a background thread to periodically scavenge memory to release back to the system +#if OS(GENODE) +#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 0 +#else #define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1 +#endif /* OS(GENODE) */ #ifndef NDEBUG namespace WTF { diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h index a8298c4..7727df2 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h @@ -480,6 +480,13 @@ #define WTF_OS_UNIX 1 #endif +/* OS(GENODE) */ +/* Operating system level dependencies for Genode that should */ +/* be used regardless of operating environment */ +#ifdef __GENODE__ +#define WTF_OS_GENODE 1 +#endif + /* Operating environments */ /* FIXME: these are all mixes of OS, operating environment and policy choices. */ @@ -581,7 +588,7 @@ #define WTF_USE_PTHREAD_BASED_QT 1 #endif -#if (PLATFORM(GTK) || PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && (OS(DARWIN) || USE(PTHREAD_BASED_QT)) && !ENABLE(SINGLE_THREADED))) && !OS(QNX) && !defined(ENABLE_JSC_MULTIPLE_THREADS) +#if (PLATFORM(GTK) || PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && (OS(DARWIN) || USE(PTHREAD_BASED_QT)) && !ENABLE(SINGLE_THREADED))) && !OS(QNX) && !defined(ENABLE_JSC_MULTIPLE_THREADS) && !OS(GENODE) #define ENABLE_JSC_MULTIPLE_THREADS 1 #endif @@ -756,7 +763,7 @@ #endif #endif /* !defined(HAVE_ACCESSIBILITY) */ -#if OS(UNIX) && !OS(SYMBIAN) +#if OS(UNIX) && !OS(SYMBIAN) && !OS(GENODE) #define HAVE_SIGNAL_H 1 #endif @@ -768,7 +775,7 @@ #if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \ && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \ - && !OS(ANDROID) && !PLATFORM(BREWMP) + && !OS(ANDROID) && !PLATFORM(BREWMP) && !OS(GENODE) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 @@ -851,6 +858,13 @@ #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_TIME_H 1 +#elif OS(GENODE) + +#define HAVE_MMAP 0 +#define HAVE_SBRK 0 +#define HAVE_SYS_TIME_H 1 +#define USE_SYSTEM_MALLOC 1 + #else /* FIXME: is this actually used or do other platforms generate their own config.h? */ @@ -1024,6 +1038,11 @@ #define ENABLE_JIT 0 #endif +/* Disable JIT for Genode */ +#if OS(GENODE) +#define ENABLE_JIT 0 +#endif + /* The JIT is enabled by default on all x86, x64-64, ARM & MIPS platforms. */ #if !defined(ENABLE_JIT) \ && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \ diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp index 6b61270..f117e48 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp +++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/StackBounds.cpp @@ -48,6 +48,10 @@ #include #include +#elif OS(GENODE) + +#include + #elif OS(UNIX) #include @@ -154,6 +158,14 @@ void StackBounds::initialize() m_bound = estimateStackBound(m_origin); } +#elif OS(GENODE) + +void StackBounds::initialize() +{ + m_bound = Genode::Thread_base::myself()->stack_base(); + m_origin = Genode::Thread_base::myself()->stack_top(); +} + #elif OS(UNIX) void StackBounds::initialize() diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp index 3cb59e8..0731d43 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp +++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp @@ -56,6 +56,12 @@ #include #endif +#if OS(GENODE) +#include +#include +#include +#endif + #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif @@ -379,6 +385,21 @@ void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size, size_t alignment) { } #endif +#if OS(GENODE) + if (actual_size) + *actual_size = size; + + void* real_address = malloc(sizeof(Genode::addr_t) + size + alignment); + Genode::addr_t address = reinterpret_cast(real_address); + address += sizeof(Genode::addr_t); + address = Genode::align_addr(address, Genode::log2(alignment)); + address -= sizeof(Genode::addr_t); + *(Genode::addr_t*)address = (Genode::addr_t)real_address; + address += sizeof(Genode::addr_t); + + return (void*)address;; +#endif + // nothing worked - reset failure flags and try again devmem_failure = false; sbrk_failure = false; diff --git a/src/3rdparty/webkit/Source/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/Source/WebCore/generated/JSDOMWindow.cpp index 6fa2ad3..d30fcc1 100644 --- a/src/3rdparty/webkit/Source/WebCore/generated/JSDOMWindow.cpp +++ b/src/3rdparty/webkit/Source/WebCore/generated/JSDOMWindow.cpp @@ -746,7 +746,9 @@ static const HashTableValue JSDOMWindowTableValues[456] = { "MessageChannel", DontDelete, (intptr_t)static_cast(jsDOMWindowMessageChannelConstructor), (intptr_t)setJSDOMWindowMessageChannelConstructor THUNK_GENERATOR(0) }, { "Worker", DontDelete, (intptr_t)static_cast(jsDOMWindowWorkerConstructor), (intptr_t)setJSDOMWindowWorkerConstructor THUNK_GENERATOR(0) }, { "SharedWorker", DontDelete, (intptr_t)static_cast(jsDOMWindowSharedWorkerConstructor), (intptr_t)setJSDOMWindowSharedWorkerConstructor THUNK_GENERATOR(0) }, +#if ENABLE(WEB_SOCKETS) { "WebSocket", DontDelete, (intptr_t)static_cast(jsDOMWindowWebSocketConstructor), (intptr_t)setJSDOMWindowWebSocketConstructor THUNK_GENERATOR(0) }, +#endif { "Plugin", DontDelete, (intptr_t)static_cast(jsDOMWindowPluginConstructor), (intptr_t)setJSDOMWindowPluginConstructor THUNK_GENERATOR(0) }, { "PluginArray", DontDelete, (intptr_t)static_cast(jsDOMWindowPluginArrayConstructor), (intptr_t)setJSDOMWindowPluginArrayConstructor THUNK_GENERATOR(0) }, { "MimeType", DontDelete, (intptr_t)static_cast(jsDOMWindowMimeTypeConstructor), (intptr_t)setJSDOMWindowMimeTypeConstructor THUNK_GENERATOR(0) }, @@ -4442,6 +4444,7 @@ JSValue jsDOMWindowSharedWorkerConstructor(ExecState* exec, JSValue slotBase, co } +#if ENABLE(WEB_SOCKETS) JSValue jsDOMWindowWebSocketConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSDOMWindow* castedThis = static_cast(asObject(slotBase)); @@ -4449,6 +4452,7 @@ JSValue jsDOMWindowWebSocketConstructor(ExecState* exec, JSValue slotBase, const return jsUndefined(); return castedThis->webSocket(exec); } +#endif JSValue jsDOMWindowPluginConstructor(ExecState* exec, JSValue slotBase, const Identifier&) diff --git a/src/3rdparty/webkit/Source/WebCore/generated/JSWorkerContext.cpp b/src/3rdparty/webkit/Source/WebCore/generated/JSWorkerContext.cpp index 3a96654..997d192 100644 --- a/src/3rdparty/webkit/Source/WebCore/generated/JSWorkerContext.cpp +++ b/src/3rdparty/webkit/Source/WebCore/generated/JSWorkerContext.cpp @@ -91,7 +91,9 @@ static const HashTableValue JSWorkerContextTableValues[25] = { "MessageChannel", DontDelete, (intptr_t)static_cast(jsWorkerContextMessageChannelConstructor), (intptr_t)setJSWorkerContextMessageChannelConstructor THUNK_GENERATOR(0) }, { "EventSource", DontDelete, (intptr_t)static_cast(jsWorkerContextEventSourceConstructor), (intptr_t)setJSWorkerContextEventSourceConstructor THUNK_GENERATOR(0) }, { "XMLHttpRequest", DontDelete, (intptr_t)static_cast(jsWorkerContextXMLHttpRequestConstructor), (intptr_t)setJSWorkerContextXMLHttpRequestConstructor THUNK_GENERATOR(0) }, +#if ENABLE(WEB_SOCKETS) { "WebSocket", DontDelete, (intptr_t)static_cast(jsWorkerContextWebSocketConstructor), (intptr_t)setJSWorkerContextWebSocketConstructor THUNK_GENERATOR(0) }, +#endif { "WebKitBlobBuilder", DontDelete, (intptr_t)static_cast(jsWorkerContextWebKitBlobBuilderConstructor), (intptr_t)setJSWorkerContextWebKitBlobBuilderConstructor THUNK_GENERATOR(0) }, { "FileReader", DontDelete, (intptr_t)static_cast(jsWorkerContextFileReaderConstructor), (intptr_t)setJSWorkerContextFileReaderConstructor THUNK_GENERATOR(0) }, { "FileReaderSync", DontDelete, (intptr_t)static_cast(jsWorkerContextFileReaderSyncConstructor), (intptr_t)setJSWorkerContextFileReaderSyncConstructor THUNK_GENERATOR(0) }, @@ -276,11 +278,13 @@ JSValue jsWorkerContextXMLHttpRequestConstructor(ExecState* exec, JSValue slotBa } +#if ENABLE(WEB_SOCKETS) JSValue jsWorkerContextWebSocketConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSWorkerContext* castedThis = static_cast(asObject(slotBase)); return castedThis->webSocket(exec); } +#endif JSValue jsWorkerContextWebKitBlobBuilderConstructor(ExecState* exec, JSValue slotBase, const Identifier&) diff --git a/src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.h b/src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.h index 50ef7f7..9511153 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.h +++ b/src/3rdparty/webkit/Source/WebCore/loader/icon/IconRecord.h @@ -38,7 +38,7 @@ #include #include -#if OS(SOLARIS) +#if OS(SOLARIS) || OS(GENODE) #include // For time_t structure. #endif diff --git a/src/3rdparty/webkit/Source/WebCore/page/Page.h b/src/3rdparty/webkit/Source/WebCore/page/Page.h index bdea870..6f400be 100644 --- a/src/3rdparty/webkit/Source/WebCore/page/Page.h +++ b/src/3rdparty/webkit/Source/WebCore/page/Page.h @@ -29,7 +29,7 @@ #include #include -#if OS(SOLARIS) +#if OS(SOLARIS) || OS(GENODE) #include // For time_t structure. #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.h b/src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.h index 250411c..c2a0fd4 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/network/ResourceResponseBase.h @@ -35,7 +35,7 @@ #include #include -#if OS(SOLARIS) +#if OS(SOLARIS) || OS(GENODE) #include // For time_t structure. #endif diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index ca5c879..85c2da1 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -92,7 +92,7 @@ #include #endif -#if defined(Q_OS_WINCE) +#if defined(Q_OS_WINCE) || defined(Q_OS_GENODE) # define QT_NO_SETLOCALE #endif diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b929776..1ecdda7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -94,6 +94,10 @@ _LIT(qt_S60Filter, "Series60v?.*.sis"); _LIT(qt_symbianSystemInstallDir, "z:\\system\\install\\"); #endif +#if defined(Q_OS_GENODE) +#include +#endif + QT_BEGIN_NAMESPACE @@ -2285,6 +2289,8 @@ void qt_message_output(QtMsgType msgType, const char *buf) TPtrC8 part(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); RDebug::Printf(format, &part); } +#elif defined(Q_OS_GENODE) + PDBG("%s", buf); #else fprintf(stderr, "%s\n", buf); fflush(stderr); diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1117c79..e5a85de 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -147,6 +147,7 @@ namespace QT_NAMESPACE {} /* The operating system, must be one of: (Q_OS_x) + GENODE - Genode DARWIN - Darwin OS (synonym for Q_OS_MAC) SYMBIAN - Symbian MSDOS - MS-DOS and Windows @@ -178,7 +179,9 @@ namespace QT_NAMESPACE {} UNIX - Any UNIX BSD/SYSV system */ -#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) +#if defined(__GENODE__) +# define Q_OS_GENODE +#elif defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) # define Q_OS_DARWIN # define Q_OS_BSD4 # ifdef __LP64__ diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 2e63854..6eb8144 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -100,6 +100,10 @@ QT_END_NAMESPACE #ifdef Q_OS_SYMBIAN #include #endif +#ifdef Q_OS_GENODE +#include +#include +#endif #ifndef QT_NO_PROCESS @@ -780,6 +784,65 @@ QProcessPrivate::QProcessPrivate() symbianProcess = NULL; processLaunched = false; #endif +#ifdef Q_OS_GENODE + launchpad_child = 0; + + /* request config file from ROM service */ + Genode::Rom_connection rom("config"); + rom.on_destruction(Genode::Rom_connection::KEEP_OPEN); + void *addr; + try { + addr = Genode::env()->rm_session()->attach(rom.dataspace()); + } catch(Genode::Parent::Service_denied) { + qWarning("Error: Couldn't open config file."); + return; + } + + /* + * The XML data of a valid config file starts with + * a tag. + */ + Genode::Xml_node config_node((const char *)addr); + + if (!config_node.has_type("config")) { + qWarning("Error: Root node of config file is not a tag."); + return; + } + + /* + * Iterate through all entries of the config file and start + * children as specified. + */ + for (int i = 0; i < config_node.num_sub_nodes(); i++) { + Genode::Xml_node program_node = config_node.sub_node(i); + if (program_node.has_type("program")) { + + /* add filename and ram_quota to ram_quota_hash */ + char filename[32]; + try { + program_node.sub_node("filename").value(filename, sizeof(filename)); + } catch (Genode::Xml_node::Nonexistent_sub_node) { + qWarning("Warning: Missing valid in config-file entry."); + return; + } + + size_t ram_quota = 0; + try { + program_node.sub_node("ram_quota").value(&ram_quota); + } catch (Genode::Xml_node::Nonexistent_sub_node) { + qWarning("Warning: Missing valid in config-file entry."); + return; + } + + ram_quota_hash()->insert(QString(filename), ram_quota); + } else { + char buf[32]; + program_node.type_name(buf, sizeof(buf)); + qWarning("Warning: Ignoring unsupported tag <%s>.", buf); + } + } + +#endif } /*! \internal diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index e1d4cbb..2ffb3aa 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -71,6 +71,11 @@ typedef int Q_PIPE; #ifndef QT_NO_PROCESS +#ifdef Q_OS_GENODE +#include +#include +#endif + QT_BEGIN_NAMESPACE class QSocketNotifier; @@ -194,6 +199,28 @@ template<> Q_INLINE_TEMPLATE void QSharedDataPointer d = x; } +#ifdef Q_OS_GENODE + +class QProcess_launchpad : public Launchpad +{ +public: + QProcess_launchpad(unsigned long initial_quota) : Launchpad(initial_quota) {} + + virtual void quota(unsigned long quota) {} + + virtual void add_launcher(const char *filename, + unsigned long default_quota) {} + + virtual void add_child(const char *unique_name, + unsigned long quota, + Launchpad_child *launchpad_child, + Genode::Allocator *alloc) {} + + virtual void remove_child(const char *name, Genode::Allocator *alloc) {} +}; + +#endif + class QProcessPrivate : public QIODevicePrivate { public: @@ -301,7 +328,7 @@ public: QWinEventNotifier *processFinishedNotifier; void startProcess(); -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_QNX) +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_QNX) && !defined(Q_OS_GENODE) void execChild(const char *workingDirectory, char **path, char **argv, char **envp); #elif defined(Q_OS_QNX) pid_t spawnChild(const char *workingDirectory, char **argv, char **envp); @@ -328,6 +355,22 @@ public: int serial; #endif +#ifdef Q_OS_GENODE + static QProcess_launchpad *launchpad() + { + static QProcess_launchpad _launchpad(Genode::env()->ram_session()->quota()); + return &_launchpad; + } + + static QHash *ram_quota_hash() + { + static QHash _ram_quota_hash; + return &_ram_quota_hash; + } + + Launchpad_child *launchpad_child; +#endif + bool waitForStarted(int msecs = 30000); bool waitForReadyRead(int msecs = 30000); bool waitForBytesWritten(int msecs = 30000); diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index d7b9d16..6352584 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -928,7 +928,7 @@ public: } }; -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined (Q_OS_NACL) && !defined(Q_OS_INTEGRITY) +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined (Q_OS_NACL) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_GENODE) #define QT_USE_MMAP #endif diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index bb07d74..fcd8465 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -82,8 +82,12 @@ # if !defined(QT_NO_GLIB) # include "qeventdispatcher_glib_p.h" # endif +# ifdef Q_OS_GENODE +# include "qeventdispatcher_genode_p.h" +# else # include "qeventdispatcher_unix_p.h" # endif +# endif #endif #ifdef Q_OS_WIN @@ -500,8 +504,12 @@ void QCoreApplicationPrivate::createEventDispatcher() eventDispatcher = new QEventDispatcherGlib(q); else # endif +# ifdef Q_OS_GENODE + eventDispatcher = new QEventDispatcherGenode(q); +# else eventDispatcher = new QEventDispatcherUNIX(q); # endif +# endif #elif defined(Q_OS_WIN) eventDispatcher = new QEventDispatcherWin32(q); #else @@ -738,7 +746,7 @@ void QCoreApplication::init() { Q_D(QCoreApplication); -#ifdef Q_OS_UNIX +#if defined(Q_OS_UNIX) && !defined(Q_OS_GENODE) setlocale(LC_ALL, ""); // use correct char set mapping qt_locale_initialized = true; #endif diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 0dbb388..73f03b6 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -60,7 +60,7 @@ #include "qlocale.h" #include "qresource.h" -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY) +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_GENODE) #define QT_USE_MMAP #include "private/qcore_unix_p.h" #endif diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 1ec331d..59f870f 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -53,7 +53,7 @@ # include "private/qcore_symbian_p.h" #endif -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) || defined(Q_OS_GENODE) QT_BEGIN_NAMESPACE @@ -139,7 +139,11 @@ QT_BEGIN_NAMESPACE Constructs a plugin loader with the given \a parent. */ QPluginLoader::QPluginLoader(QObject *parent) - : QObject(parent), d(0), did_load(false) + : QObject(parent), +#ifndef Q_OS_GENODE + d(0), +#endif + did_load(false) { } @@ -157,7 +161,11 @@ QPluginLoader::QPluginLoader(QObject *parent) \sa setFileName() */ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent) - : QObject(parent), d(0), did_load(false) + : QObject(parent), +#ifndef Q_OS_GENODE + d(0), +#endif + did_load(false) { setFileName(fileName); } @@ -172,8 +180,10 @@ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent) */ QPluginLoader::~QPluginLoader() { +#ifndef Q_OS_GENODE if (d) d->release(); +#endif } /*! @@ -200,9 +210,13 @@ QObject *QPluginLoader::instance() { if (!load()) return 0; +#ifdef Q_OS_GENODE + return 0; +#else if (!d->inst && d->instance) d->inst = d->instance(); return d->inst.data(); +#endif } /*! @@ -217,6 +231,7 @@ QObject *QPluginLoader::instance() */ bool QPluginLoader::load() { +#ifndef Q_OS_GENODE if (!d || d->fileName.isEmpty()) return false; if (did_load) @@ -225,6 +240,9 @@ bool QPluginLoader::load() return false; did_load = true; return d->loadPlugin(); +#else + return false; +#endif } @@ -246,12 +264,14 @@ bool QPluginLoader::load() */ bool QPluginLoader::unload() { +#ifndef Q_OS_GENODE if (did_load) { did_load = false; return d->unload(); } if (d) // Ouch d->errorString = tr("The plugin was not loaded."); +#endif return false; } @@ -262,7 +282,11 @@ bool QPluginLoader::unload() */ bool QPluginLoader::isLoaded() const { +#ifndef Q_OS_GENODE return d && d->pHnd && d->instance; +#else + return false; +#endif } /*! @@ -285,6 +309,7 @@ bool QPluginLoader::isLoaded() const */ void QPluginLoader::setFileName(const QString &fileName) { +#ifndef Q_OS_GENODE #if defined(QT_SHARED) QLibrary::LoadHints lh; if (d) { @@ -348,13 +373,17 @@ void QPluginLoader::setFileName(const QString &fileName) } Q_UNUSED(fileName); #endif +#endif } QString QPluginLoader::fileName() const { +#ifndef Q_OS_GENODE if (d) return d->fileName; +#else return QString(); +#endif } /*! @@ -364,7 +393,11 @@ QString QPluginLoader::fileName() const */ QString QPluginLoader::errorString() const { +#ifndef Q_OS_GENODE return (!d || d->errorString.isEmpty()) ? tr("Unknown error") : d->errorString; +#else + return QString(); +#endif } typedef QList StaticInstanceFunctionList; @@ -383,7 +416,7 @@ Q_GLOBAL_STATIC(StaticInstanceFunctionList, staticInstanceFunctionList) \sa QLibrary::loadHints */ - +#ifndef Q_OS_GENODE void QPluginLoader::setLoadHints(QLibrary::LoadHints loadHints) { if (!d) { @@ -402,7 +435,7 @@ QLibrary::LoadHints QPluginLoader::loadHints() const } return d->loadHints; } - +#endif /*! \relates QPluginLoader \since 4.4 diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h index ad8f230..7033cc3 100644 --- a/src/corelib/plugin/qpluginloader.h +++ b/src/corelib/plugin/qpluginloader.h @@ -49,21 +49,23 @@ #pragma message("QT_NO_LIBRARY is not supported on Windows") #endif -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) || defined(Q_OS_GENODE) QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Core) - +#ifndef Q_OS_GENODE class QLibraryPrivate; - +#endif class Q_CORE_EXPORT QPluginLoader : public QObject { Q_OBJECT Q_PROPERTY(QString fileName READ fileName WRITE setFileName) +#ifndef Q_OS_GENODE Q_PROPERTY(QLibrary::LoadHints loadHints READ loadHints WRITE setLoadHints) +#endif public: explicit QPluginLoader(QObject *parent = 0); explicit QPluginLoader(const QString &fileName, QObject *parent = 0); @@ -81,12 +83,15 @@ public: QString fileName() const; QString errorString() const; - +#ifndef Q_OS_GENODE void setLoadHints(QLibrary::LoadHints loadHints); QLibrary::LoadHints loadHints() const; +#endif private: +#ifndef Q_OS_GENODE QLibraryPrivate *d; +#endif bool did_load; Q_DISABLE_COPY(QPluginLoader) }; diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h index 036a17d..f012256 100644 --- a/src/corelib/thread/qmutex_p.h +++ b/src/corelib/thread/qmutex_p.h @@ -64,6 +64,12 @@ QT_BEGIN_NAMESPACE +#include + +#ifdef Q_OS_GENODE +#include +#endif + class QMutexPrivate : public QMutexData { public: QMutexPrivate(QMutex::RecursionMode mode); @@ -79,10 +85,12 @@ public: Qt::HANDLE owner; uint count; -#if defined(Q_OS_UNIX) && !defined(Q_OS_LINUX) && !defined(Q_OS_SYMBIAN) +#if defined(Q_OS_UNIX) && !defined(Q_OS_LINUX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_GENODE) volatile bool wakeup; pthread_mutex_t mutex; pthread_cond_t cond; +#elif defined(Q_OS_GENODE) + Genode::Timed_semaphore sem; #elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) HANDLE event; #elif defined(Q_OS_SYMBIAN) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 2b818ff..4651268 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -175,7 +175,12 @@ QThreadPrivate::QThreadPrivate(QThreadData *d) stackSize(0), priority(QThread::InheritPriority), data(d) { #if defined (Q_OS_UNIX) +#ifdef Q_OS_GENODE + thread_id = 0; + genode_thread = 0; +#else thread_id = 0; +#endif #elif defined (Q_WS_WIN) handle = 0; id = 0; diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 1ba89cc..c543f45 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -54,6 +54,10 @@ // // +#ifdef Q_OS_GENODE +#include +#endif + #include "qplatformdefs.h" #include "QtCore/qthread.h" #include "QtCore/qmutex.h" @@ -158,6 +162,56 @@ public: static QThread *threadForId(int id); #ifdef Q_OS_UNIX +#ifdef Q_OS_GENODE + + class Genode_thread : public Genode::Thread_qt + { + private: + + /* + * The '_finished_lock' is necessary because 'QThreadPrivate::mutex' + * uses a 'Genode::Timed_semaphore' internally and it isn't safe + * to delete a Genode thread that just called 'Semaphore::up()', + * because the 'Semaphore::_meta_lock' could still be locked. + */ + Genode::Lock _finished_lock; + QThread *_qthread; + + public: + + Genode_thread(QThread *qthread) + : _finished_lock(Genode::Lock::LOCKED), + _qthread(qthread) { } + + virtual void entry() + { + QThreadPrivate::start(_qthread); + QThreadPrivate::finish(_qthread); + _finished_lock.unlock(); + } + + void join() + { + _finished_lock.lock(); + } + }; + + Genode_thread *genode_thread; + + struct tls_struct { + QThreadData *data; + bool termination_enabled; + }; + + static QHash tls; + + Qt::HANDLE thread_id; + QWaitCondition thread_done; + + static void start(QThread *thr); + static void finish(QThread *thr); + +#else // Q_OS_UNIX && !Q_OS_GENODE pthread_t thread_id; QWaitCondition thread_done; @@ -167,7 +221,7 @@ public: #else static void finish(void *); #endif - +#endif // Q_OS_GENODE #endif // Q_OS_UNIX #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 167a6c5..1f55fd3 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3108,6 +3108,9 @@ QTime QTime::currentTime() // posix compliant system struct timeval tv; gettimeofday(&tv, 0); +#ifdef Q_OS_GENODE + ct.mds = (tv.tv_sec * 1000) + (tv.tv_usec / 1000); +#else time_t ltime = tv.tv_sec; struct tm *t = 0; @@ -3122,6 +3125,7 @@ QTime QTime::currentTime() Q_CHECK_PTR(t); ct.mds = msecsFromDecomposed(t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000); +#endif /* Q_OS_GENODE */ return ct; } @@ -4008,6 +4012,10 @@ static QDate adjustDate(QDate date) static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) { +#ifdef Q_OS_GENODE + /* no timezones in Genode */ + return QDateTimePrivate::LocalUnknown; +#endif QDate fakeDate = adjustDate(date); // won't overflow because of fakeDate @@ -4096,6 +4104,10 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) static void localToUtc(QDate &date, QTime &time, int isdst) { +#ifdef Q_OS_GENODE + /* no timezones in Genode */ + return; +#endif if (!date.isValid()) return; diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 2dd342a..e6a5c17 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -880,7 +880,7 @@ Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded if (!path.startsWith(QLatin1Char('~'))) return path; QString ret = path; -#if !defined(Q_OS_INTEGRITY) +#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_GENODE) QStringList tokens = ret.split(QDir::separator()); if (tokens.first() == QLatin1String("~")) { ret.replace(0, 1, QDir::homePath()); diff --git a/src/gui/embedded/qscreendriverfactory_qws.cpp b/src/gui/embedded/qscreendriverfactory_qws.cpp index 6726064..5726a90 100644 --- a/src/gui/embedded/qscreendriverfactory_qws.cpp +++ b/src/gui/embedded/qscreendriverfactory_qws.cpp @@ -49,6 +49,9 @@ #include "qscreenmulti_qws_p.h" #include "qscreenqnx_qws.h" #include "qscreenintegrityfb_qws.h" +#ifdef Q_OS_GENODE +#include "qscreennitpicker_qws.h" +#endif #include #include "private/qfactoryloader_p.h" #include "qscreendriverplugin_qws.h" @@ -141,6 +144,12 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId) if (driver == QLatin1String("multi")) return new QMultiScreen(displayId); #endif +#ifdef Q_OS_GENODE +#ifndef QT_NO_QWS_NITPICKER + if (driver == QLatin1String("nitpicker") || driver.isEmpty()) + return new QNitpickerScreen(displayId); +#endif +#endif #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) #ifndef QT_NO_LIBRARY @@ -182,6 +191,11 @@ QStringList QScreenDriverFactory::keys() #ifndef QT_NO_QWS_MULTISCREEN list << QLatin1String("Multi"); #endif +#ifdef Q_OS_GENODE +#ifndef QT_NO_QWS_NITPICKER + list << QLatin1String("Nitpicker"); +#endif +#endif #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) #ifndef QT_NO_LIBRARY diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp index 9027232..2ea5695 100644 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ b/src/gui/embedded/qwindowsystem_qws.cpp @@ -3360,8 +3360,15 @@ QWSWindow* QWSServerPrivate::findWindow(int windowid, QWSClient* client) void QWSServerPrivate::raiseWindow(QWSWindow *changingw, int /*alt*/) { Q_Q(QWSServer); - if (changingw == windows.first()) + + if (changingw == windows.first()) { +#ifndef QT_NO_QWS_NITPICKER + // make sure that the Nitpicker view is on top, too + emit q->windowEvent(changingw, QWSServer::Raise); +#endif return; + } + QWSWindow::State oldstate = changingw->d->state; changingw->d->state = QWSWindow::Raising; // Expose regions previously overlapped by transparent windows diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index e90c61c..35828fa 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -199,7 +199,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz } } - +#ifdef PNG_WRITE_SUPPORTED static void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length) { @@ -218,6 +218,7 @@ static void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */) { } +#endif #if defined(Q_C_CALLBACKS) } @@ -226,12 +227,13 @@ void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */) static void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float screen_gamma=0.0) { +#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) if (screen_gamma != 0.0 && png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) { double file_gamma; png_get_gAMA(png_ptr, info_ptr, &file_gamma); png_set_gamma(png_ptr, screen_gamma, file_gamma); } - +#endif png_uint_32 width; png_uint_32 height; int bit_depth; @@ -442,13 +444,13 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() png_ptr = 0; return false; } - +#ifdef PNG_SETJMP_SUPPORTED if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); png_ptr = 0; return false; } - +#endif png_set_read_fn(png_ptr, this, iod_read_fn); png_read_info(png_ptr, info_ptr); @@ -472,6 +474,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) } row_pointers = 0; +#ifdef PNG_SETJMP_SUPPORTED if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); delete [] row_pointers; @@ -479,7 +482,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) state = Error; return false; } - +#endif setup_qt(*outImage, png_ptr, info_ptr, gamma); if (outImage->isNull()) { @@ -510,9 +513,9 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) if (outImage->depth()==32 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { QRgb trans = 0xFF000000 | qRgb( - (info_ptr->trans_values.red << 8 >> bit_depth)&0xff, - (info_ptr->trans_values.green << 8 >> bit_depth)&0xff, - (info_ptr->trans_values.blue << 8 >> bit_depth)&0xff); + (info_ptr->trans_color.red << 8 >> bit_depth)&0xff, + (info_ptr->trans_color.green << 8 >> bit_depth)&0xff, + (info_ptr->trans_color.blue << 8 >> bit_depth)&0xff); for (uint y=0; ywidth; x++) { if (((uint**)jt)[y][x] == trans) { @@ -637,7 +640,7 @@ void QPNGImageWriter::setGamma(float g) gamma = g; } - +#ifdef PNG_WRITE_SUPPORTED #ifndef QT_NO_IMAGE_TEXT static void set_text(const QImage &image, png_structp png_ptr, png_infop info_ptr, const QString &description) @@ -713,6 +716,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt delete [] text_ptr; } #endif +#endif bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y) { @@ -722,6 +726,8 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y) bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, int quality_in, const QString &description, int off_x_in, int off_y_in) { +#ifdef PNG_WRITE_SUPPORTED + #ifdef QT_NO_IMAGE_TEXT Q_UNUSED(description); #endif @@ -745,12 +751,12 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, in png_destroy_write_struct(&png_ptr, 0); return false; } - +#ifdef PNG_SETJMP_SUPPORTED if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); return false; } - +#endif int quality = quality_in; if (quality >= 0) { if (quality > 9) { @@ -775,9 +781,11 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, in image.depth() == 1 ? 1 : 8, // per channel color_type, 0, 0, 0); // sets #channels +#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) if (gamma != 0.0) { png_set_gAMA(png_ptr, info_ptr, 1.0/gamma); } +#endif png_color_8 sig_bit; sig_bit.red = 8; @@ -903,6 +911,9 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, in png_destroy_write_struct(&png_ptr, &info_ptr); return true; +#else + return false; +#endif } static bool write_png_image(const QImage &image, QIODevice *device, diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index ec545c2..1fe727d 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -848,8 +848,16 @@ static bool read_xpm_header( #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) #else +#ifdef Q_OS_GENODE + *w = QString(buf).section(" ", 0, 0, QString::SectionSkipEmpty).toInt(); + *h = QString(buf).section(" ", 1, 1, QString::SectionSkipEmpty).toInt(); + *ncols = QString(buf).section(" ", 2, 2, QString::SectionSkipEmpty).toInt(); + *cpp = QString(buf).section(" ", 3, 3, QString::SectionSkipEmpty).toInt(); + if (*w <= 0 || *h <= 0 || *ncols <= 0 || *cpp <= 0) +#else if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) #endif +#endif return false; // < 4 numbers parsed return true; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index d0db0d9..edc6800 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -733,11 +733,23 @@ void QApplicationPrivate::process_cmdline() */ QApplication::QApplication(int &argc, char **argv) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000)) + : QCoreApplication(*new QApplicationPrivate(argc, argv, +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + , 0x040000)) { Q_D(QApplication); d->construct(); } QApplication::QApplication(int &argc, char **argv, int _internal) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal)) + : QCoreApplication(*new QApplicationPrivate(argc, argv, +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + , _internal)) { Q_D(QApplication); d->construct(); } @@ -767,11 +779,23 @@ QApplication::QApplication(int &argc, char **argv, int _internal) */ QApplication::QApplication(int &argc, char **argv, bool GUIenabled ) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, 0x040000)) + : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + : Tty, 0x040000)) { Q_D(QApplication); d->construct(); } QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _internal) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, _internal)) + : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + : Tty, _internal)) { Q_D(QApplication); d->construct();} @@ -905,7 +929,13 @@ static char *aargv[] = { (char*)"unknown", 0 }; This function is only available on X11. */ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap) - : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, 0x040000)) + : QCoreApplication(*new QApplicationPrivate(aargc, aargv, +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + , 0x040000)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); @@ -914,7 +944,13 @@ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap) } QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, int _internal) - : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, _internal)) + : QCoreApplication(*new QApplicationPrivate(aargc, aargv, +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + , _internal)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); @@ -939,7 +975,13 @@ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, */ QApplication::QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000)) + : QCoreApplication(*new QApplicationPrivate(argc, argv, +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + , 0x040000)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); @@ -949,7 +991,13 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv, QApplication::QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap, int _internal) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal)) + : QCoreApplication(*new QApplicationPrivate(argc, argv, +#ifndef Q_OS_GENODE + GuiClient +#else + GuiServer +#endif + , _internal)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 3ac3544..25851d5 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -196,6 +196,7 @@ QString qws_dataDir() WaitForFileSystemInitialization(); #endif +#ifndef Q_OS_GENODE if (QT_MKDIR(dataDir, 0700)) { if (errno != EEXIST) { qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData()); @@ -216,6 +217,7 @@ QString qws_dataDir() if ((buf.st_mode & 0677) != 0600) qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData()); #endif +#endif /* Q_OS_GENODE */ result.append(QLatin1Char('/')); return result; @@ -463,7 +465,11 @@ void QApplicationPrivate::createEventDispatcher() #endif eventDispatcher = (q->type() != QApplication::Tty ? new QEventDispatcherQWS(q) +#ifdef Q_OS_GENODE + : new QEventDispatcherGenode(q)); +#else : new QEventDispatcherUNIX(q)); +#endif } // Single-process stuff. This should maybe move into qwindowsystem_qws.cpp @@ -2896,9 +2902,15 @@ int QApplication::qwsProcessEvent(QWSEvent* event) // The server has grabbed the mouse for us. // Remember which of my widgets has it. qt_pressGrab = w; - if (!widget->isActiveWindow() && + if ( +#ifdef QT_NO_QWS_NITPICKER // make sure that the Nitpicker view is on top, too + !widget->isActiveWindow() && +#endif (!app_do_modal || QApplication::activeModalWidget() == widget) && !((widget->windowFlags() & Qt::FramelessWindowHint) || (widget->windowType() == Qt::Tool))) { +#ifndef QT_NO_QWS_NITPICKER + if (!widget->isActiveWindow()) +#endif widget->activateWindow(); if (widget->raiseOnClick()) widget->raise(); diff --git a/src/gui/kernel/qeventdispatcher_qws.cpp b/src/gui/kernel/qeventdispatcher_qws.cpp index e26aabc..e64776e 100644 --- a/src/gui/kernel/qeventdispatcher_qws.cpp +++ b/src/gui/kernel/qeventdispatcher_qws.cpp @@ -46,7 +46,11 @@ #include "qwsevent_qws.h" #include "qwindowsystem_qws.h" #include "qeventdispatcher_qws_p.h" +#ifdef Q_OS_GENODE +#include "private/qeventdispatcher_genode_p.h" +#else #include "private/qeventdispatcher_unix_p.h" +#endif #ifndef QT_NO_THREAD # include "qmutex.h" #endif @@ -57,7 +61,11 @@ QT_BEGIN_NAMESPACE QT_USE_NAMESPACE +#ifdef Q_OS_GENODE +class QEventDispatcherQWSPrivate : public QEventDispatcherGenodePrivate +#else class QEventDispatcherQWSPrivate : public QEventDispatcherUNIXPrivate +#endif { Q_DECLARE_PUBLIC(QEventDispatcherQWS) public: @@ -68,7 +76,11 @@ public: QEventDispatcherQWS::QEventDispatcherQWS(QObject *parent) +#ifdef Q_OS_GENODE + : QEventDispatcherGenode(*new QEventDispatcherQWSPrivate, parent) +#else : QEventDispatcherUNIX(*new QEventDispatcherQWSPrivate, parent) +#endif { } QEventDispatcherQWS::~QEventDispatcherQWS() @@ -129,7 +141,11 @@ bool QEventDispatcherQWS::processEvents(QEventLoop::ProcessEventsFlags flags) QWSServer::processEventQueue(); } +#ifdef Q_OS_GENODE + if (QEventDispatcherGenode::processEvents(flags)) +#else if (QEventDispatcherUNIX::processEvents(flags)) +#endif return true; } return (nevents > 0); @@ -158,11 +174,11 @@ void QEventDispatcherQWS::flush() (void)qt_fbdpy->eventPending(); // flush } - +#ifndef Q_OS_GENODE int QEventDispatcherQWS::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout) { return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout); } - +#endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/kernel/qeventdispatcher_qws_p.h index 703057d..64b0469 100644 --- a/src/gui/kernel/qeventdispatcher_qws_p.h +++ b/src/gui/kernel/qeventdispatcher_qws_p.h @@ -53,13 +53,23 @@ // We mean it. // +#include "qplatformdefs.h" + +#ifdef Q_OS_GENODE +#include "private/qeventdispatcher_genode_p.h" +#else #include "private/qeventdispatcher_unix_p.h" +#endif QT_BEGIN_NAMESPACE class QEventDispatcherQWSPrivate; +#ifdef Q_OS_GENODE +class QEventDispatcherQWS : public QEventDispatcherGenode +#else class QEventDispatcherQWS : public QEventDispatcherUNIX +#endif { Q_OBJECT Q_DECLARE_PRIVATE(QEventDispatcherQWS) @@ -77,8 +87,10 @@ public: void closingDown(); protected: +#ifndef Q_OS_GENODE int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout); +#endif }; QT_END_NAMESPACE diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index ec925e9..7afcd0a 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -393,6 +393,43 @@ static void initializeDb() } #endif + + QDir dir(fontpath, QLatin1String("*.qpf")); + for (int i=0; iaddFont(familyname, /*foundry*/ "qt", weight, italic, pixelSize, QFile::encodeName(dir.absoluteFilePath(dir[i])), + /*fileIndex*/ 0, /*antialiased*/ true); + } + +#ifndef QT_NO_FREETYPE + dir.setNameFilters(QStringList() << QLatin1String("*.ttf") + << QLatin1String("*.ttc") << QLatin1String("*.pfa") + << QLatin1String("*.pfb")); + dir.refresh(); + for (int i = 0; i < int(dir.count()); ++i) { + const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i])); +// qDebug() << "looking at" << file; + QByteArray data; + QFile f(file); + if (!(f.fileEngine()->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::LocalDiskFlag)) { + if (!f.open(QIODevice::ReadOnly)) + continue; + data = f.readAll(); + } + db->addTTFile(file, data); + } +#endif + #ifndef QT_NO_QWS_QPF2 QDir dir(fontpath, QLatin1String("*.qpf2")); for (int i = 0; i < int(dir.count()); ++i) { diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 9b89fae..ec242b7 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -304,6 +304,23 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) { cache_cost = 1; +#ifdef Q_OS_GENODE + + QFile ff(fn); + if (!ff.open(QIODevice::ReadOnly)) { + qFatal("Failed to open %s", QFile::encodeName(fn).data()); + } + + uchar* data = new uchar[ff.size()]; + + for (int i = 0; i < ff.size(); i++) { + ff.getChar(reinterpret_cast(&data[i])); + } + + ff.close(); + +#else + int fd = QT_OPEN(QFile::encodeName(fn).constData(), O_RDONLY, 0); if (fd == -1) qFatal("Failed to open '%s'", QFile::encodeName(fn).constData()); @@ -312,7 +329,11 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) if (QT_FSTAT(fd, &st) != 0) qFatal("Failed to stat '%s'", QFile::encodeName(fn).constData()); +#endif /* Q_OS_GENODE */ + d = new QFontEngineQPF1Data; + +#ifndef Q_OS_GENODE d->mmapStart = 0; d->mmapLength = st.st_size; @@ -338,7 +359,7 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) if (d->mmapStart) { uchar* data = d->mmapStart; - +#endif /* Q_OS_GENODE */ memcpy(reinterpret_cast(&d->fm), data, sizeof(d->fm)); data += sizeof(d->fm); @@ -356,7 +377,9 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) << "underlinepos" << d->fm.underlinepos << "underlinewidth" << d->fm.underlinewidth; #endif +#ifndef Q_OS_GENODE } +#endif /* Q_OS_GENODE */ } QFontEngineQPF1::~QFontEngineQPF1() diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 8ec6a15..65ad5be 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -114,6 +114,7 @@ void QNetworkAccessFileBackend::open() url.setPath(QLatin1String("/")); setUrl(url); +#ifndef Q_OS_GENODE QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { if (url.scheme() == QLatin1String("qrc")) @@ -121,6 +122,10 @@ void QNetworkAccessFileBackend::open() else fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } +#else + QString fileName = QLatin1String(":") + url.path(); +#endif + file.setFileName(fileName); if (operation() == QNetworkAccessManager::GetOperation) { diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index 6909340..93a6c56 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -147,6 +147,11 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) QHostAddress address; if (address.setAddress(hostName)) { // Reverse lookup +#ifdef Q_OS_GENODE + results.setError(QHostInfo::HostNotFound); + results.setErrorString(tr("Reverse lookup is not implemented because of missing support in lwip.")); + return results; +#else // Reverse lookups using getnameinfo are broken on darwin, use gethostbyaddr instead. #if !defined (QT_NO_GETADDRINFO) && !defined (Q_OS_DARWIN) sockaddr_in sa4; @@ -181,7 +186,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) if (ent) results.setHostName(QString::fromLatin1(ent->h_name)); #endif - +#endif if (results.hostName().isEmpty()) results.setHostName(address.toString()); results.setAddresses(QList() << address); diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp index db9c59d..df797f0 100644 --- a/tools/designer/src/lib/uilib/formbuilder.cpp +++ b/tools/designer/src/lib/uilib/formbuilder.cpp @@ -44,6 +44,8 @@ #include "formbuilderextra_p.h" #include "ui4_p.h" +#include "qpluginloader.h" + #include #include @@ -493,7 +495,7 @@ static void insertPlugins(QObject *o, QMapbuilder.loader = this; - +#ifndef Q_OS_GENODE QStringList paths; foreach (const QString &path, QApplication::libraryPaths()) { QString libPath = path; @@ -640,6 +640,7 @@ QUiLoader::QUiLoader(QObject *parent) } d->builder.setPluginPath(paths); +#endif } /*!