summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoronestone <onestone>2006-12-18 01:02:50 +0000
committeronestone <onestone>2006-12-18 01:02:50 +0000
commitcf18e40e8ec251d66d29cdc31e6e79318b8e51f7 (patch)
tree838a3160206b24b20ef9466291b1f8902b3d7662
parent3e5b79c544c3ec59f72bc2619a1d9fa4c3fca484 (diff)
downloadaquamarine-cf18e40e8ec251d66d29cdc31e6e79318b8e51f7.tar.gz
aquamarine-cf18e40e8ec251d66d29cdc31e6e79318b8e51f7.tar.bz2
aquamarine: now using XComposite to get decoration pixmap
-rw-r--r--src/decorator.cpp20
-rw-r--r--src/defaultShadow.cpp1
-rw-r--r--src/window.cpp44
-rw-r--r--src/window.h10
4 files changed, 64 insertions, 11 deletions
diff --git a/src/decorator.cpp b/src/decorator.cpp
index f4a6b25..ff101fd 100644
--- a/src/decorator.cpp
+++ b/src/decorator.cpp
@@ -223,6 +223,26 @@ Aquamarine::Decorator::x11EventFilter (XEvent * xevent)
switch (xevent->type)
{
+ case MapNotify:
+ {
+ Aquamarine::Window * client = 0;
+ if (m_frames.contains (xevent->xmap.window))
+ client = m_frames[xevent->xmap.window];
+ if (!client)
+ break;
+ client->setMapping(true);
+ break;
+ }
+ case UnmapNotify:
+ {
+ Aquamarine::Window * client = 0;
+ if (m_frames.contains (xevent->xunmap.window))
+ client = m_frames[xevent->xunmap.window];
+ if (!client)
+ break;
+ client->setMapping(false);
+ break;
+ }
case DestroyNotify:
if (xevent->xdestroywindow.window == m_activeWM)
{
diff --git a/src/defaultShadow.cpp b/src/defaultShadow.cpp
index 83f2246..c89119d 100644
--- a/src/defaultShadow.cpp
+++ b/src/defaultShadow.cpp
@@ -41,7 +41,6 @@
#include <kglobal.h>
#define BERYL_ADVANCED_DECORATION_VERSION 10121980
-#define DECOR_WINDOW_MASK (1 << 0)
#define GRAVITY_WEST (1 << 0)
#define GRAVITY_EAST (1 << 1)
diff --git a/src/window.cpp b/src/window.cpp
index 268bb90..b45f986 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -63,7 +63,6 @@
#include <qpopupmenu.h>
#define BERYL_ADVANCED_DECORATION_VERSION 10121980
-#define DECOR_WINDOW_MASK (1 << 0)
#define GRAVITY_WEST (1 << 0)
#define GRAVITY_EAST (1 << 1)
@@ -149,6 +148,10 @@ m_brightness_menu (0), m_saturation_menu (0), m_opacity_menu (0)
else
m_soffset.setCoords(0,0,0,0);
+ m_currentPixmap = None;
+ m_updatePixmap = true;
+ m_mapped = true;
+
setWState (Qt::WState_Visible);
updateFrame (frame);
@@ -180,6 +183,11 @@ Aquamarine::Window::~Window ()
{
XDeleteProperty (qt_xdisplay (), m_wid, my_atom);
}
+
+ if (m_currentPixmap != None)
+ XFreePixmap (qt_xdisplay(), m_currentPixmap);
+
+
Aquamarine::popXError ();
}
@@ -789,7 +797,7 @@ Aquamarine::Window::resizeDecoration ()
kdDebug () << k_funcinfo << endl;
-
+ m_updatePixmap = true;
move (m_geometry.x() - left + m_soffset.left(),
m_geometry.y() - top + m_soffset.top());
@@ -811,7 +819,7 @@ void
Aquamarine::Window::updateWindowProperties ()
{
- WId win = handle();
+ Pixmap pix = XCompositeNameWindowPixmap(qt_xdisplay(),handle());
int top, bottom, left, right;
int mtop, mbottom, mleft, mright;
@@ -835,7 +843,7 @@ Aquamarine::Window::updateWindowProperties ()
*data++ = BERYL_ADVANCED_DECORATION_VERSION;
- memcpy (data++, &win, sizeof (win));
+ memcpy (data++, &pix, sizeof (pix));
*data++ = left;
*data++ = right;
@@ -850,7 +858,7 @@ Aquamarine::Window::updateWindowProperties ()
*data++ = 0;
*data++ = 0;
- *data++ = DECOR_WINDOW_MASK;
+ *data++ = 0;
*data++ = (unsigned short)((Settings::activeOpacity() / 100.0) * 0xffff);
*data++ = (unsigned short)((Settings::inactiveOpacity() / 100.0) * 0xffff);
@@ -1038,6 +1046,9 @@ Aquamarine::Window::updateWindowProperties ()
15 + (12 * 9));
Aquamarine::popXError ();
XSync (qt_xdisplay (), FALSE);
+ if (m_currentPixmap != None)
+ XFreePixmap(qt_xdisplay(),m_currentPixmap);
+ m_currentPixmap = pix;
}
void
@@ -1072,7 +1083,7 @@ Aquamarine::Window::updateFrame (WId frame)
}
if (m_deco && frame == handle())
{
- updateWindowProperties ();
+ //updateWindowProperties ();
XSelectInput (qt_xdisplay (), m_frame,
defaultMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | EnterWindowMask | LeaveWindowMask);
@@ -1565,6 +1576,25 @@ XRenderSetPictureFilter_wrapper (Display *dpy,
}
}
+void Aquamarine::Window::setMapping (bool map)
+{
+ m_mapped = map;
+ if (!m_mapped)
+ m_shapeSet = false;
+}
+
+void Aquamarine::Window::updateWindow ()
+{
+ if (!m_mapped) return;
+
+ if (m_updatePixmap)
+ {
+ updateWindowProperties();
+ m_updatePixmap = false;
+ }
+ renderShadow();
+}
+
#define XRenderSetPictureFilter XRenderSetPictureFilter_wrapper
#endif
@@ -1752,7 +1782,7 @@ Aquamarine::Window::eventFilter (QObject * watched, QEvent * event)
bool rv = QWidget::eventFilter (watched, event);
if (event->type () == QEvent::Paint)
{
- QTimer::singleShot (0, this, SLOT(renderShadow()));
+ QTimer::singleShot (0, this, SLOT(updateWindow()));
}
return rv;
diff --git a/src/window.h b/src/window.h
index 917dc92..388567e 100644
--- a/src/window.h
+++ b/src/window.h
@@ -138,6 +138,8 @@ namespace Aquamarine
readWindowPropertyDefault (m_wid, Atoms::saturation, 0xffff);
}
+ void setMapping (bool map);
+
protected:
virtual bool eventFilter (QObject * watched, QEvent * event);
@@ -166,9 +168,10 @@ namespace Aquamarine
void performMouseCommand( Options::MouseCommand, QMouseEvent *qme );
XFixed *createGaussianKernel (int *r_size);
void setPictureTransform (Picture p, int dx, int dy);
+ void renderShadow ();
private slots:
- void renderShadow ();
+ void updateWindow ();
void updateWindowProperties ();
void slotPopupActivated (int id);
void slotPopupAboutToShow ();
@@ -192,8 +195,9 @@ namespace Aquamarine
// decoration stuff
KDecoration *m_deco;
- QPixmap m_qpixmap;
- QPixmap m_pending_pixmap;
+ Pixmap m_currentPixmap;
+ bool m_updatePixmap;
+ bool m_mapped;
bool m_fakeMaximized;
// shape stuff