From 577525c2bb33d610b22f59f95b2f176293b26aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 10 Sep 2013 07:09:44 +0200 Subject: [PATCH] Use Xcb::Window wraper for Toplevel::client Uses the new API to not destroy the window in the dtor. At the same time the variable is renamed to m_client to follow the common naming scheme. --- toplevel.cpp | 6 +++--- toplevel.h | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/toplevel.cpp b/toplevel.cpp index 3b3d6895db..f3b9be045a 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -41,7 +41,7 @@ Toplevel::Toplevel() , info(NULL) , ready_for_painting(true) , m_isDamaged(false) - , client(None) + , m_client() , frame(None) , damage_handle(None) , is_shape(false) @@ -110,7 +110,7 @@ void Toplevel::copyToDeleted(Toplevel* c) vis = c->vis; bit_depth = c->bit_depth; info = c->info; - client = c->client; + m_client.reset(c->m_client, false); frame = c->frame; ready_for_painting = c->ready_for_painting; damage_handle = None; @@ -400,7 +400,7 @@ void Toplevel::getWmOpaqueRegion() Atom type; int rformat; unsigned long nitems; - if (XGetWindowProperty(display(), client, + if (XGetWindowProperty(display(), m_client, atoms->net_wm_opaque_region, 0, length, false, XA_CARDINAL, &type, &rformat, &nitems, &bytes_after_return, reinterpret_cast< unsigned char** >(&data)) == Success) { diff --git a/toplevel.h b/toplevel.h index 5caf08ceab..8ac1a59c38 100644 --- a/toplevel.h +++ b/toplevel.h @@ -26,6 +26,7 @@ along with this program. If not, see . // kwin #include "utils.h" #include "virtualdesktops.h" +#include "xcbutils.h" // KDE #include // Qt @@ -166,7 +167,7 @@ class Toplevel public: explicit Toplevel(); Window frameId() const; - Window window() const; + xcb_window_t window() const; QRect geometry() const; QSize size() const; QPoint pos() const; @@ -346,7 +347,7 @@ protected Q_SLOTS: protected: virtual ~Toplevel(); - void setWindowHandles(Window client, Window frame); + void setWindowHandles(xcb_window_t client, xcb_window_t frame); void detectShape(Window id); virtual void propertyNotifyEvent(xcb_property_notify_event_t *e); virtual void damageNotifyEvent(); @@ -389,7 +390,7 @@ private: static QByteArray staticWmCommand(xcb_window_t); static xcb_window_t staticWmClientLeader(xcb_window_t); // when adding new data members, check also copyToDeleted() - Window client; + Xcb::Window m_client; Window frame; xcb_damage_damage_t damage_handle; QRegion damage_region; // damage is really damaged window (XDamage) and texture needs @@ -409,9 +410,9 @@ private: // when adding new data members, check also copyToDeleted() }; -inline Window Toplevel::window() const +inline xcb_window_t Toplevel::window() const { - return client; + return m_client; } inline Window Toplevel::frameId() const @@ -419,10 +420,10 @@ inline Window Toplevel::frameId() const return frame; } -inline void Toplevel::setWindowHandles(Window w, Window f) +inline void Toplevel::setWindowHandles(xcb_window_t w, xcb_window_t f) { - assert(client == None && w != None); - client = w; + assert(!m_client.isValid() && w != XCB_WINDOW_NONE); + m_client.reset(w, false); assert(frame == None && f != None); frame = f; }