aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FbWindow.cc15
-rw-r--r--src/FbTk/FbWindow.hh12
-rw-r--r--src/fluxbox.cc7
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 @@
31#include <X11/Xutil.h> 31#include <X11/Xutil.h>
32#include <X11/Xatom.h> 32#include <X11/Xatom.h>
33 33
34#ifdef HAVE_CASSERT 34#include <cassert>
35 #include <cassert>
36#else
37 #include <assert.h>
38#endif
39
40#include <limits> 35#include <limits>
41 36
42namespace FbTk { 37namespace FbTk {
43 38
39Window FbWindow::rootWindow(Display* dpy, Drawable win) {
40 union { int i; unsigned int ui; } ignore;
41 Window root = None;
42 XGetGeometry(dpy, win, &root, &ignore.i, &ignore.i, &ignore.ui, &ignore.ui, &ignore.ui, &ignore.ui);
43 return root;
44}
45
46
44FbWindow::FbWindow(): 47FbWindow::FbWindow():
45 FbDrawable(), 48 FbDrawable(),
46 m_parent(0), m_screen_num(0), m_window(0), 49 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 @@
24 24
25#include "FbDrawable.hh" 25#include "FbDrawable.hh"
26#include "FbString.hh" 26#include "FbString.hh"
27
27#include <memory> 28#include <memory>
28#include <string> 29#include <string>
29#include <set> 30#include <set>
30 31#include <cmath>
31#ifdef HAVE_CMATH
32 #include <cmath>
33#else
34 #include <math.h>
35#endif
36 32
37namespace FbTk { 33namespace FbTk {
38 34
@@ -54,8 +50,10 @@ class FbWindowRenderer;
54 */ 50 */
55class FbWindow: public FbDrawable { 51class FbWindow: public FbDrawable {
56public: 52public:
57 FbWindow();
58 53
54 static Window rootWindow(Display* dpy, Drawable win);
55
56 FbWindow();
59 FbWindow(const FbWindow &win_copy); 57 FbWindow(const FbWindow &win_copy);
60 58
61 FbWindow(int screen_num, 59 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) {
976 976
977BScreen *Fluxbox::searchScreen(Window window) { 977BScreen *Fluxbox::searchScreen(Window window) {
978 978
979 Window window_root = FbTk::FbWindow::rootWindow(display(), window);
980 if (window_root == None) {
981 return 0;
982 }
983
979 ScreenList::iterator it = m_screen_list.begin(); 984 ScreenList::iterator it = m_screen_list.begin();
980 ScreenList::iterator it_end = m_screen_list.end(); 985 ScreenList::iterator it_end = m_screen_list.end();
981 for (; it != it_end; ++it) { 986 for (; it != it_end; ++it) {
982 if (*it && (*it)->rootWindow() == window) 987 if (*it && (*it)->rootWindow() == window_root)
983 return *it; 988 return *it;
984 } 989 }
985 990