From 255d96ce45bad1ef93112d45eaadeaac61df1fd2 Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Sun, 3 Jun 2007 20:14:33 +0000
Subject: store the EWMH window in Screen.cc, so it gets destroyed when we
 destroy the screen

---
 src/Ewmh.cc   | 14 +-------------
 src/Ewmh.hh   |  3 ---
 src/Screen.cc |  2 ++
 src/Screen.hh |  5 ++++-
 4 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 5c6d70b..5a6bdfa 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -73,13 +73,6 @@ Ewmh::Ewmh() {
     createAtoms();
 }
 
-Ewmh::~Ewmh() {
-    while (!m_windows.empty()) {
-        XDestroyWindow(FbTk::App::instance()->display(), m_windows.back());
-        m_windows.pop_back();
-    }
-}
-
 void Ewmh::initForScreen(BScreen &screen) {
     Display *disp = FbTk::App::instance()->display();
 
@@ -102,14 +95,9 @@ void Ewmh::initForScreen(BScreen &screen) {
      * Window Manager is present.
      */
 
-    Window wincheck = XCreateSimpleWindow(disp,
-                                          screen.rootWindow().window(),
-                                          -10, -10, 5, 5, 0, 0, 0);
+    Window wincheck = screen.dummyWindow().window();
 
     if (wincheck != None) {
-        // store the window so we can delete it later
-        m_windows.push_back(wincheck);
-
         screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32,
                                            PropModeReplace, (unsigned char *) &wincheck, 1);
         XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32,
diff --git a/src/Ewmh.hh b/src/Ewmh.hh
index f917390..3df66d3 100644
--- a/src/Ewmh.hh
+++ b/src/Ewmh.hh
@@ -34,7 +34,6 @@ class Ewmh:public AtomHandler {
 public:
 
     Ewmh();
-    ~Ewmh();
     void initForScreen(BScreen &screen);
     void setupFrame(FluxboxWindow &win);
     void setupClient(WinClient &winclient);
@@ -142,7 +141,5 @@ private:
 
     Atom utf8_string;
 
-    std::vector<Window> m_windows;
-
     FbTk::FbString getUTF8Property(Atom property);
 };
diff --git a/src/Screen.cc b/src/Screen.cc
index 915c055..096286b 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -359,6 +359,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
                  0, 0, 10, 10,
                  false,  // override redirect
                  true), // save under
+    m_dummy_window(scrn, -1, -1, 1, 1, 0, true, false, CopyFromParent,
+                   InputOnly),
     resource(rm, screenname, altscreenname),
     m_resource_manager(rm),
     m_name(screenname),
diff --git a/src/Screen.hh b/src/Screen.hh
index 602d5b9..0d2534d 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -309,6 +309,9 @@ public:
     FbRootWindow &rootWindow() { return m_root_window; }
     const FbRootWindow &rootWindow() const { return m_root_window; }
 
+    FbTk::FbWindow &dummyWindow() { return m_dummy_window; }
+    const FbTk::FbWindow &dummyWindow() const { return m_dummy_window; }
+
     FbTk::MultLayers &layerManager() { return m_layermanager; }
     const FbTk::MultLayers &layerManager() const { return m_layermanager; }
     FbTk::ResourceManager &resourceManager() { return m_resource_manager; }
@@ -557,7 +560,7 @@ private:
     std::auto_ptr<RootTheme> m_root_theme;
 
     FbRootWindow m_root_window;
-    FbTk::FbWindow m_geom_window, m_pos_window;
+    FbTk::FbWindow m_geom_window, m_pos_window, m_dummy_window;
 
     struct ScreenResource {
         ScreenResource(FbTk::ResourceManager &rm, const std::string &scrname,
-- 
cgit v0.11.2