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.
Mathias Gumz akira@fluxbox.org
3 files changed,
20 insertions(+),
14 deletions(-)
M
src/FbTk/FbWindow.cc
→
src/FbTk/FbWindow.cc
@@ -31,15 +31,18 @@
#include <X11/Xutil.h> #include <X11/Xatom.h> -#ifdef HAVE_CASSERT - #include <cassert> -#else - #include <assert.h> -#endif - +#include <cassert> #include <limits> 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
src/FbTk/FbWindow.hh
→
src/FbTk/FbWindow.hh
@@ -24,15 +24,11 @@ #define FBTK_FBWINDOW_HH
#include "FbDrawable.hh" #include "FbString.hh" + #include <memory> #include <string> #include <set> - -#ifdef HAVE_CMATH - #include <cmath> -#else - #include <math.h> -#endif +#include <cmath> namespace FbTk {@@ -54,8 +50,10 @@ * @see EventManager
*/ class FbWindow: public FbDrawable { public: - FbWindow(); + static Window rootWindow(Display* dpy, Drawable win); + + FbWindow(); FbWindow(const FbWindow &win_copy); FbWindow(int screen_num,
M
src/fluxbox.cc
→
src/fluxbox.cc
@@ -976,10 +976,15 @@ }
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; }