From c0e5d1c7a3867a82e0418e921afabf8e14909429 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Thu, 22 Jan 2015 10:14:12 +0100 Subject: Fix broken _NET_REQUEST_FRAME_EXTENTS support There was a subtle flaw in the way fluxbox detects to which BScreen a given Window belongs: We have to compare the RootWindow of the given Window against the RootWindow of each BScreen. That underlying flaw made _NET_REQUEST_FRAME_EXTENTS fail: the code path needs a valid BScreen for the given window, otherwise we return early. Closes #1121. --- src/FbTk/FbWindow.cc | 15 +++++++++------ src/FbTk/FbWindow.hh | 12 +++++------- src/fluxbox.cc | 7 ++++++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 1930d4e..357a26f 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc @@ -31,16 +31,19 @@ #include #include -#ifdef HAVE_CASSERT - #include -#else - #include -#endif - +#include #include namespace FbTk { +Window FbWindow::rootWindow(Display* dpy, Drawable win) { + union { int i; unsigned int ui; } ignore; + Window root = None; + XGetGeometry(dpy, win, &root, &ignore.i, &ignore.i, &ignore.ui, &ignore.ui, &ignore.ui, &ignore.ui); + return root; +} + + FbWindow::FbWindow(): FbDrawable(), m_parent(0), m_screen_num(0), m_window(0), diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index 4b6b02f..5501d88 100644 --- a/src/FbTk/FbWindow.hh +++ b/src/FbTk/FbWindow.hh @@ -24,15 +24,11 @@ #include "FbDrawable.hh" #include "FbString.hh" + #include #include #include - -#ifdef HAVE_CMATH - #include -#else - #include -#endif +#include namespace FbTk { @@ -54,8 +50,10 @@ class FbWindowRenderer; */ class FbWindow: public FbDrawable { public: - FbWindow(); + static Window rootWindow(Display* dpy, Drawable win); + + FbWindow(); FbWindow(const FbWindow &win_copy); FbWindow(int screen_num, diff --git a/src/fluxbox.cc b/src/fluxbox.cc index ab05f56..9b787f7 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -976,10 +976,15 @@ void Fluxbox::attachSignals(WinClient &winclient) { BScreen *Fluxbox::searchScreen(Window window) { + Window window_root = FbTk::FbWindow::rootWindow(display(), window); + if (window_root == None) { + return 0; + } + ScreenList::iterator it = m_screen_list.begin(); ScreenList::iterator it_end = m_screen_list.end(); for (; it != it_end; ++it) { - if (*it && (*it)->rootWindow() == window) + if (*it && (*it)->rootWindow() == window_root) return *it; } -- cgit v0.11.2