[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/artwork/oxygen-transparent/libs
From: Hugo Pereira Da Costa <hugo () oxygen-icons ! org>
Date: 2010-12-28 10:53:56
Message-ID: 20101228105356.B3E4DAC8AD () svn ! kde ! org
[Download RAW message or body]
SVN commit 1209863 by hpereiradacosta:
Merged revisions 1208663 via svnmerge from
svn+ssh://hpereiradacosta@svn.kde.org/home/kde/trunk/KDE/kdebase/workspace/libs/oxygen
........
r1208663 | hpereiradacosta | 2010-12-22 20:19:18 +0100 (Wed, 22 Dec 2010) | 4 lines
Added hasBackgroundGradient set and check methods, based on WM hints.
This is used to have oxygen window decoration and widget style (qt and gtk) match \
better, with no need for "window specific overrides".
........
_M . (directory)
M +50 -1 oxygenhelper.cpp
M +14 -0 oxygenhelper.h
--- trunk/playground/artwork/oxygen-transparent/libs/oxygenhelper.cpp \
#1209862:1209863 @@ -69,9 +69,11 @@
// create argb atom
_argbAtom = XInternAtom( QX11Info::display(), "_KDE_NET_WM_HAS_ARGB", \
False);
+ // create background gradient atom
+ _backgroundGradientAtom = XInternAtom( QX11Info::display(), \
"_KDE_OXYGEN_BACKGROUND_GRADIENT", False); +
#endif
-
}
//____________________________________________________________________
@@ -766,6 +768,53 @@
#endif
}
+ //____________________________________________________________________
+ void Helper::setHasBackgroundGradient( WId id, bool value ) const
+ {
+
+ if( !id ) return;
+
+ #ifdef Q_WS_X11
+ unsigned long uLongValue( value );
+ XChangeProperty(
+ QX11Info::display(), id, _backgroundGradientAtom, XA_CARDINAL, 32, \
PropModeReplace, + reinterpret_cast<const unsigned char *>(&uLongValue), 1 \
); + #else
+ Q_UNUSED( id );
+ Q_UNUSED( value );
+ #endif
+ return;
+ }
+
+ //____________________________________________________________________
+ bool Helper::hasBackgroundGradient( WId id ) const
+ {
+ if( !id ) return false;
+
+ #ifdef Q_WS_X11
+ Atom type( None );
+ int format(0);
+ unsigned char *data(0);
+
+ unsigned long n(0), left(0);
+ XGetWindowProperty(
+ QX11Info::display(), id, _backgroundGradientAtom,
+ 0, 1L, false,
+ XA_CARDINAL, &type,
+ &format, &n, &left,
+ &data);
+
+ // finish if no data is found
+ if( data == None || n != 1 ) return false;
+ else return *data;
+
+ #else
+
+ return false;
+
+ #endif
+ }
+
//______________________________________________________________________________________
void Helper::drawSlab( QPainter& p, const QColor& color, qreal shade )
{
--- trunk/playground/artwork/oxygen-transparent/libs/oxygenhelper.h #1209862:1209863
@@ -279,6 +279,17 @@
//@}
+ //!@name background gradient XProperty
+ //@{
+
+ //! set background gradient hint to widget
+ virtual void setHasBackgroundGradient( WId, bool ) const;
+
+ //! true if background gradient hint is set
+ virtual bool hasBackgroundGradient( WId ) const;
+
+ //@}
+
protected:
virtual void drawSlab( QPainter&, const QColor&, qreal shade );
@@ -342,6 +353,9 @@
#ifdef Q_WS_X11
//! argb hint atom
Atom _argbAtom;
+
+ //! background gradient hint atom
+ Atom _backgroundGradientAtom;
#endif
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic