-rw-r--r-- | core/launcher/libpreload/config.in | 5 | ||||
-rw-r--r-- | core/launcher/libpreload/libpreload.pro | 14 | ||||
-rw-r--r-- | core/launcher/libpreload/preload.cpp | 91 |
3 files changed, 110 insertions, 0 deletions
diff --git a/core/launcher/libpreload/config.in b/core/launcher/libpreload/config.in new file mode 100644 index 0000000..c3cfd6f --- a/dev/null +++ b/core/launcher/libpreload/config.in @@ -0,0 +1,5 @@ +config LIBPRELOAD + boolean "Preload library" + default "y" if ! X11 + default "n" if X11 + depends on ! X11 diff --git a/core/launcher/libpreload/libpreload.pro b/core/launcher/libpreload/libpreload.pro new file mode 100644 index 0000000..210cbdd --- a/dev/null +++ b/core/launcher/libpreload/libpreload.pro @@ -0,0 +1,14 @@ +TEMPLATE = lib + +CONFIG = release warn_on + +SOURCES = preload.cpp + +HEADERS = + +INCLUDEPATH += $(QTDIR)/include + +DESTDIR = $(OPIEDIR)/lib +TARGET = preload + +VERSION = 1.0.0 diff --git a/core/launcher/libpreload/preload.cpp b/core/launcher/libpreload/preload.cpp new file mode 100644 index 0000000..a94ec65 --- a/dev/null +++ b/core/launcher/libpreload/preload.cpp @@ -0,0 +1,91 @@ + +#define _GNU_SOURCE +//#define private public +//#define protected public + +#include <qwsdecoration_qws.h> +#include <qcommonstyle.h> +//#include <qpe/qpeapplication.h> + +class QStyle; +class QApplication; +class QFont; +class QWSDecoration; + +#include <dlfcn.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> + + +typedef void ( *qapp_setstyle_t ) ( QStyle * ); +typedef void ( *qapp_setdeco_t ) ( QApplication *, QWSDecoration * ); +typedef void ( *qapp_setfont_t ) ( QApplication *, const QFont &, bool, const char * ); + + +static bool *opie_block_style_p = 0; + +extern "C" { + +static void *resolve_symbol ( const char *sym ) +{ + void *adr = ::dlsym ( RTLD_NEXT, sym ); + + if ( !adr ) + ::fprintf ( stderr, "PANIC: Could not resolve symbol \"%s\"\n", sym ); + + return adr; +} + +extern void setStyle__12QApplicationP6QStyle ( QStyle *style ) +{ + static qapp_setstyle_t qsetstyle = 0; + + if ( !qsetstyle ) + qsetstyle = (qapp_setstyle_t) resolve_symbol ( "setStyle__12QApplicationP6QStyle" ); + + if ( !opie_block_style_p ) + opie_block_style_p = (bool *) resolve_symbol ( "opie_block_style" ); + + if ( !qsetstyle || ( opie_block_style_p && *opie_block_style_p )) { + delete style; + return; + } + else + ( *qsetstyle ) ( style ); +} + +extern void setFont__12QApplicationRC5QFontbPCc ( QApplication *app, const QFont &fnt, bool informWidgets, const char * className ) +{ + static qapp_setfont_t qsetfont = 0; + + if ( !qsetfont ) + qsetfont = (qapp_setfont_t) resolve_symbol ( "setFont__12QApplicationRC5QFontbPCc" ); + + if ( !opie_block_style_p ) + opie_block_style_p = (bool *) resolve_symbol ( "opie_block_style" ); + + if ( qsetfont && !( opie_block_style_p && *opie_block_style_p )) + ( *qsetfont ) ( app, fnt, informWidgets, className ); +} + + +extern void qwsSetDecoration__12QApplicationP13QWSDecoration ( QApplication *app, QWSDecoration *deco ) +{ + static qapp_setdeco_t qsetdeco = 0; + + if ( !qsetdeco ) + qsetdeco = (qapp_setdeco_t) resolve_symbol ( "qwsSetDecoration__12QApplicationP13QWSDecoration" ); + + if ( !opie_block_style_p ) + opie_block_style_p = (bool *) resolve_symbol ( "opie_block_style" ); + + if ( !qsetdeco || ( opie_block_style_p && *opie_block_style_p )) { + delete deco; + return; + } + else + ( *qsetdeco ) ( app, deco ); +} + +} |