diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 23:38:28 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 23:38:28 +0000 |
commit | 47ee068d2c202c4006d5a916fb2cfa4d4071230d (patch) | |
tree | ca18f62ea3a5300b4e94f757208abf47fecad42f /kdecore/kapplication.h | |
parent | db9d51186b28bc2252032458b433ba5f8d1972bc (diff) | |
download | tdelibs-47ee068d2c202c4006d5a916fb2cfa4d4071230d.tar.gz tdelibs-47ee068d2c202c4006d5a916fb2cfa4d4071230d.zip |
Add composition manager detection and support to Trinity
This adds the methods required to make transparent widgets via alpha blending a reality
An additional widget class may be coming shortly
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1246265 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/kapplication.h')
-rw-r--r-- | kdecore/kapplication.h | 89 |
1 files changed, 87 insertions, 2 deletions
diff --git a/kdecore/kapplication.h b/kdecore/kapplication.h index 93820b68d..00a6429da 100644 --- a/kdecore/kapplication.h +++ b/kdecore/kapplication.h @@ -48,6 +48,8 @@ class KSessionManaged; class KStyle; class KURL; +#define COMPOSITE // [FIXME] Autodetect composition support + #define kapp KApplication::kApplication() class KApplicationPrivate; @@ -113,6 +115,10 @@ public: * This constructor takes aboutData and command line * arguments from KCmdLineArgs. * + * If ARGB (transparent) widgets are to be used in your application, + * please use KARGBApplication(new object name) or + * KARGBApplication(new object name, allow_styles) instead of KApplication(...). + * * @param allowStyles Set to false to disable the loading on plugin based * styles. This is only useful to applications that do not display a GUI * normally. If you do create an application with @p allowStyles set to false @@ -860,15 +866,88 @@ public: */ TQString checkRecoverFile( const TQString& pFilename, bool& bRecover ) const; -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) && defined(COMPOSITE) /** + * @internal * Get the X11 display * @return the X11 Display */ - Display *getDisplay() { return display; } + Display *getDisplay() { return display; } + + /** + * @internal + * Gets X11 composition information + */ + void getX11RGBAInformation(Display *dpy); + + /** + * Gets the availability of a composition manager such as kompmgr + * Note that at least one application must have called detectCompositionManagerAvailable + * while the current X display was active in order for this method to return valid results. + * @see detectCompositionManagerAvailable() + * @return whether the composition manager is enabled + */ + static bool isCompositionManagerAvailable(); + + /** + * Detects the availability of a composition manager such as kompmgr + * Note that calling this method will probably cause the screen to flicker. + * @see isCompositionManagerAvailable() + * @param force_available If set, force TDE to assume a composition manager is available + * @return whether the composition manager is enabled + */ + bool detectCompositionManagerAvailable(bool force_available=false); + + /** + * @internal + * Opens an X11 display and returns the handle to it + * @return the X11 display handle + */ + Display *openX11RGBADisplay(); #endif /** + * @internal + * Creates a default KApplication with transparency support + * (if available) + */ + static KApplication KARGBApplicationObject( bool allowStyles=true ); + + #define KARGBApplication(objectname, ...) const KApplication &__kapplication_internal_app = KApplication::KARGBApplicationObject(__VA_ARGS__); KApplication &objectname = const_cast<KApplication&>(__kapplication_internal_app); + + /** + * Returns the X11 display visual + * + * @return A pointer to the X11 display visual + */ + Qt::HANDLE getX11RGBAVisual(Display *dpy); + + /** + * Returns the X11 display colormap + * + * @return An X11 display colormap object + */ + Qt::HANDLE getX11RGBAColormap(Display *dpy); + + /** + * Returns whether or not X11 composition is available + * + * You must first call getX11RGBAInformation() + * + * Note that getX11RGBAInformation() has already + * been called if you used the default KApplication + * constructor. + * + * Additionally, at least one application must have called + * detectCompositionManagerAvailable while the current X + * display was active in order for this method to return + * valid results. + * + * @return true if composition is available + */ + bool isX11CompositionAvailable(); + + /** * Enables style plugins. * * This is useful only to applications that normally @@ -1201,6 +1280,12 @@ private: void dcopClientPostInit(); void initUrlActionRestrictions(); + bool argb_visual; +#if defined(Q_WS_X11) && defined(COMPOSITE) + Qt::HANDLE argb_x11_visual; + Qt::HANDLE argb_x11_colormap; +#endif + public: /** * @internal |