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.
This commit is contained in:
Mathias Gumz 2015-01-22 10:14:12 +01:00
parent 5428edf3da
commit c0e5d1c7a3
3 changed files with 20 additions and 14 deletions

View file

@ -31,16 +31,19 @@
#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_parent(0), m_screen_num(0), m_window(0),

View file

@ -24,15 +24,11 @@
#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 @@ 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,

View file

@ -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;
}