summaryrefslogtreecommitdiff
path: root/kde
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2009-03-10 02:58:52 +0100
committerDennis kasprzyk <onestone@compiz-fusion.org>2009-03-10 03:04:40 +0100
commit678cd60bc535f9839cbf4f92718dd3f0797ff1fb (patch)
treefc619918bd00d0a432f28ab62abdb9c001fc8ae9 /kde
parent27b783143efa8b3fa3dcebe26e2bc55147d76404 (diff)
downloadzcomp-678cd60bc535f9839cbf4f92718dd3f0797ff1fb.tar.gz
zcomp-678cd60bc535f9839cbf4f92718dd3f0797ff1fb.tar.bz2
Added support for QT 4.5 raster graphicssystem.
Diffstat (limited to 'kde')
-rw-r--r--kde/window-decorator-kde4/decorator.cpp6
-rw-r--r--kde/window-decorator-kde4/decorator.h2
-rw-r--r--kde/window-decorator-kde4/main.cpp40
-rw-r--r--kde/window-decorator-kde4/switcher.cpp39
-rw-r--r--kde/window-decorator-kde4/switcher.h2
-rw-r--r--kde/window-decorator-kde4/window.cpp34
-rw-r--r--kde/window-decorator-kde4/window.h5
7 files changed, 66 insertions, 62 deletions
diff --git a/kde/window-decorator-kde4/decorator.cpp b/kde/window-decorator-kde4/decorator.cpp
index f2a5bb1..b8d09e9 100644
--- a/kde/window-decorator-kde4/decorator.cpp
+++ b/kde/window-decorator-kde4/decorator.cpp
@@ -91,10 +91,8 @@ KWD::PluginManager::PluginManager (KSharedConfigPtr config):
}
-KWD::Decorator::Decorator (Display* display,
- Qt::HANDLE visual,
- Qt::HANDLE colormap) :
- KApplication (display, visual, colormap),
+KWD::Decorator::Decorator () :
+ KApplication (),
mConfig (0),
mCompositeWindow (0),
mSwitcher (0)
diff --git a/kde/window-decorator-kde4/decorator.h b/kde/window-decorator-kde4/decorator.h
index 65802c4..e3c6d75 100644
--- a/kde/window-decorator-kde4/decorator.h
+++ b/kde/window-decorator-kde4/decorator.h
@@ -84,7 +84,7 @@ class PluginManager:public KDecorationPlugins {
class Decorator:public KApplication {
Q_OBJECT public:
- Decorator (Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
+ Decorator ();
~Decorator (void);
static NETRootInfo *rootInfo (void)
diff --git a/kde/window-decorator-kde4/main.cpp b/kde/window-decorator-kde4/main.cpp
index 767adde..eec6bae 100644
--- a/kde/window-decorator-kde4/main.cpp
+++ b/kde/window-decorator-kde4/main.cpp
@@ -46,11 +46,6 @@ main (int argc, char **argv)
int status;
int event, error;
Time timestamp;
- Colormap colormap = 0;
- Visual *visual = 0;
- int event_base, error_base;
- Display *dpy;
- int screen;
QString appname;
options.add ("replace", ki18n ("Replace existing window decorator"));
@@ -94,43 +89,10 @@ main (int argc, char **argv)
blurType = BLUR_TYPE_ALL;
}
- dpy = XOpenDisplay(0); // open default display
- screen = DefaultScreen (dpy);
- if (!dpy) {
- kError() << "Cannot connect to the X server" << endl;
- return 0;
- }
-
- if (XRenderQueryExtension (dpy, &event_base, &error_base))
- {
- int nvi;
- XVisualInfo templ;
- templ.screen = screen;
- templ.depth = 32;
- templ.c_class = TrueColor;
- XVisualInfo *xvi = XGetVisualInfo (dpy, VisualScreenMask |
- VisualDepthMask |
- VisualClassMask, &templ, &nvi);
-
- for (int i = 0; i < nvi; i++)
- {
- XRenderPictFormat *format =
- XRenderFindVisualFormat (dpy, xvi[i].visual);
- if (format->type == PictTypeDirect && format->direct.alphaMask)
- {
- visual = xvi[i].visual;
- colormap = XCreateColormap (dpy, RootWindow (dpy, screen),
- visual, AllocNone);
- break;
- }
- }
- }
-
// Disable window less child widgets
QApplication::setAttribute(Qt::AA_NativeWindows, true);
- app = new KWD::Decorator (dpy, visual ? Qt::HANDLE(visual) : 0,
- colormap ? Qt::HANDLE(colormap) : 0);
+ app = new KWD::Decorator ();
if (args->isSet ("sm-disable"))
app->disableSessionManagement ();
diff --git a/kde/window-decorator-kde4/switcher.cpp b/kde/window-decorator-kde4/switcher.cpp
index 0150d91..bdb2936 100644
--- a/kde/window-decorator-kde4/switcher.cpp
+++ b/kde/window-decorator-kde4/switcher.cpp
@@ -38,8 +38,11 @@
#include <QString>
#include <QPainter>
+
KWD::Switcher::Switcher (WId, WId id):
-mId (id)
+ mId (id),
+ mX11Pixmap (0),
+ mX11BackgroundPixmap (0)
{
QPalette palette;
long prop[4];
@@ -86,6 +89,10 @@ mId (id)
KWD::Switcher::~Switcher ()
{
+ if (mX11Pixmap)
+ XFreePixmap (QX11Info::display (), mX11Pixmap);
+ if (mX11BackgroundPixmap)
+ XFreePixmap (QX11Info::display (), mX11BackgroundPixmap);
delete mBackground;
}
@@ -104,8 +111,23 @@ KWD::Switcher::updateGeometry ()
KWD::readWindowProperty (mId, Atoms::switchSelectWindow,
(long *)&mSelected);
- mPixmap = QPixmap (width + mBorder.left + mBorder.right,
- height + mBorder.top + mBorder.bottom);
+ if (mX11Pixmap)
+ XFreePixmap (QX11Info::display (), mX11Pixmap);
+ if (mX11BackgroundPixmap)
+ XFreePixmap (QX11Info::display (), mX11BackgroundPixmap);
+
+ mX11Pixmap = XCreatePixmap (QX11Info::display (),
+ QX11Info::appRootWindow (),
+ width + mBorder.left + mBorder.right,
+ height + mBorder.top + mBorder.bottom, 32);
+
+ mX11BackgroundPixmap = XCreatePixmap (QX11Info::display (),
+ QX11Info::appRootWindow (),
+ width, height, 32);
+
+ mPixmap = QPixmap::fromX11Pixmap (mX11Pixmap, QPixmap::ExplicitlyShared);
+ mBackgroundPixmap = QPixmap::fromX11Pixmap (mX11BackgroundPixmap,
+ QPixmap::ExplicitlyShared);
redrawPixmap ();
update ();
@@ -122,6 +144,7 @@ void
KWD::Switcher::redrawPixmap ()
{
QPainter p (&mPixmap);
+ QPainter bp (&mBackgroundPixmap);
const int contentWidth = mPixmap.width ();
const int contentHeight = mPixmap.height ();
@@ -134,12 +157,12 @@ KWD::Switcher::redrawPixmap ()
mBackground->resizeFrame (QSizeF (contentWidth, contentHeight));
mBackground->paintFrame (&p, QRect (0, 0, contentWidth, contentHeight));
- mBackgroundPixmap = mPixmap.copy (mBorder.left, mBorder.top,
- mGeometry.width (),
- mGeometry.height ());
+ bp.drawPixmap (0, 0, mPixmap, mBorder.left, mBorder.top,
+ mGeometry.width (), mGeometry.height ());
XSetWindowBackgroundPixmap (QX11Info::display (), mId,
- mBackgroundPixmap.handle ());
+ mX11BackgroundPixmap);
+
XClearWindow (QX11Info::display (), mId);
}
@@ -196,7 +219,7 @@ KWD::Switcher::updateWindowProperties ()
nQuad = decor_set_lXrXtXbX_window_quads (quads, &mContext, &mDecorLayout,
lh / 2, rh / 2, w, w / 2);
- decor_quads_to_property (data, mPixmap.handle (),
+ decor_quads_to_property (data, mX11Pixmap,
&mBorder, &mBorder,
0, 0,
quads, nQuad);
diff --git a/kde/window-decorator-kde4/switcher.h b/kde/window-decorator-kde4/switcher.h
index bc969d7..f6305a0 100644
--- a/kde/window-decorator-kde4/switcher.h
+++ b/kde/window-decorator-kde4/switcher.h
@@ -72,7 +72,9 @@ class Switcher
Plasma::FrameSvg *mBackground;
QPixmap mPixmap;
+ Pixmap mX11Pixmap;
QPixmap mBackgroundPixmap;
+ Pixmap mX11BackgroundPixmap;
decor_layout_t mDecorLayout;
decor_context_t mContext;
diff --git a/kde/window-decorator-kde4/window.cpp b/kde/window-decorator-kde4/window.cpp
index c87919d..0d0c1d4 100644
--- a/kde/window-decorator-kde4/window.cpp
+++ b/kde/window-decorator-kde4/window.cpp
@@ -72,6 +72,8 @@ KWD::Window::Window (WId parentId,
mClientId (clientId),
mSelectedId (0),
mDecor (0),
+ mTexturePixmap (0),
+ mTexturePixmapBuffer (0),
mPixmap (0),
mDamageId (0),
mShadow (0),
@@ -170,6 +172,12 @@ KWD::Window::~Window (void)
if (mDecorationPicture)
XRenderFreePicture (QX11Info::display(), mDecorationPicture);
+ if (mTexturePixmap)
+ XFreePixmap (QX11Info::display(), mTexturePixmap);
+
+ if (mTexturePixmapBuffer)
+ XFreePixmap (QX11Info::display(), mTexturePixmapBuffer);
+
if (mDecor)
delete mDecor;
@@ -1091,19 +1099,30 @@ KWD::Window::updateShadow (void)
if (mTexturePicture)
XRenderFreePicture (QX11Info::display(), mTexturePicture);
- mTexturePixmap = QPixmap (mLayout.width, mLayout.height);
- mTexturePixmapBuffer = QPixmap (mLayout.width, mLayout.height);
+ if (mTexturePixmap)
+ XFreePixmap (QX11Info::display(), mTexturePixmap);
+
+ if (mTexturePixmapBuffer)
+ XFreePixmap (QX11Info::display(), mTexturePixmapBuffer);
+
+ mTexturePixmap = XCreatePixmap (QX11Info::display(),
+ QX11Info::appRootWindow (),
+ mLayout.width, mLayout.height, 32);
+ mTexturePixmapBuffer = XCreatePixmap (QX11Info::display(),
+ QX11Info::appRootWindow (),
+ mLayout.width, mLayout.height, 32);
+ mTexturePixmapSize = QSize (mLayout.width, mLayout.height);
xformat = XRenderFindStandardFormat (QX11Info::display(),
PictStandardARGB32);
mDecorationPicture =
XRenderCreatePicture (QX11Info::display(),
- mTexturePixmap.handle (),
+ mTexturePixmap,
xformat, 0, NULL);
mTexturePicture =
XRenderCreatePicture (QX11Info::display(),
- mTexturePixmapBuffer.handle (),
+ mTexturePixmapBuffer,
xformat, 0, NULL);
decor_fill_picture_extents_with_shadow (QX11Info::display(),
@@ -1554,7 +1573,7 @@ KWD::Window::updateProperty (void)
minWidth = 1;
}
- decor_quads_to_property (data, mTexturePixmap.handle (),
+ decor_quads_to_property (data, mTexturePixmap,
&normExtents, &maxExtents,
minWidth, 0,
quads, nQuad);
@@ -1564,7 +1583,6 @@ KWD::Window::updateProperty (void)
decor_gen_window_property (data, &normExtents, &maxExtents, 1, 0);
}
-
KWD::trapXError ();
XChangeProperty (QX11Info::display(), mClientId, atom,
XA_INTEGER,
@@ -2184,8 +2202,8 @@ KWD::Window::processDamage (void)
0, 0,
0, 0,
0, 0,
- mTexturePixmap.width (),
- mTexturePixmap.height ());
+ mTexturePixmapSize.width (),
+ mTexturePixmapSize.height ());
if (mUpdateProperty)
updateProperty ();
diff --git a/kde/window-decorator-kde4/window.h b/kde/window-decorator-kde4/window.h
index fe25cbf..c8229a6 100644
--- a/kde/window-decorator-kde4/window.h
+++ b/kde/window-decorator-kde4/window.h
@@ -252,8 +252,9 @@ class Window:public QWidget, public KDecorationBridgeUnstable {
decor_extents_t mBorder;
unsigned short mOpacity;
KDecoration *mDecor;
- QPixmap mTexturePixmap;
- QPixmap mTexturePixmapBuffer;
+ Pixmap mTexturePixmap;
+ Pixmap mTexturePixmapBuffer;
+ QSize mTexturePixmapSize;
Pixmap mPixmap;
QRegion mDamage;
WId mDamageId;