aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-10 22:50:19 (GMT)
committerfluxgen <fluxgen>2003-05-10 22:50:19 (GMT)
commit26df4622fd3ce8d7dae67f6f24cda4771801935f (patch)
tree9aa1bcbdbb4fdd2c204a8c48cec1951922db4c46 /src
parent8142aae84e5577c7dbbd908e4477c0d9b61f27ae (diff)
downloadfluxbox_paul-26df4622fd3ce8d7dae67f6f24cda4771801935f.zip
fluxbox_paul-26df4622fd3ce8d7dae67f6f24cda4771801935f.tar.bz2
root window
Diffstat (limited to 'src')
-rw-r--r--src/FbRootWindow.cc63
-rw-r--r--src/FbRootWindow.hh49
2 files changed, 112 insertions, 0 deletions
diff --git a/src/FbRootWindow.cc b/src/FbRootWindow.cc
new file mode 100644
index 0000000..d555f7f
--- /dev/null
+++ b/src/FbRootWindow.cc
@@ -0,0 +1,63 @@
1// FbRootWindow.cc
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen<at>users.sourceforge.net)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id: FbRootWindow.cc,v 1.1 2003/05/10 22:50:19 fluxgen Exp $
23
24#include "FbRootWindow.hh"
25#include "App.hh"
26
27#include <X11/Xutil.h>
28
29FbRootWindow::FbRootWindow(int screen_num):
30 FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)),
31 m_visual(0),
32 m_colormap(0) {
33
34 Display *disp = FbTk::App::instance()->display();
35
36 // search for a TrueColor Visual... if we can't find one... we will use the
37 // default visual for the screen
38 XVisualInfo vinfo_template, *vinfo_return;
39 int vinfo_nitems;
40
41 vinfo_template.screen = screen_num;
42 vinfo_template.c_class = TrueColor;
43 if ((vinfo_return = XGetVisualInfo(disp,
44 VisualScreenMask | VisualClassMask,
45 &vinfo_template, &vinfo_nitems)) &&
46 vinfo_nitems > 0) {
47
48 for (int i = 0; i < vinfo_nitems; i++) {
49 if (DefaultDepth(disp, screen_num) < vinfo_return[i].depth)
50 m_visual = vinfo_return[i].visual;
51 }
52
53 XFree(vinfo_return);
54 }
55
56 if (m_visual) {
57 m_colormap = XCreateColormap(disp, window(),
58 m_visual, AllocNone);
59 } else {
60 m_visual = DefaultVisual(disp, screen_num);
61 m_colormap = DefaultColormap(disp, screen_num);
62 }
63}
diff --git a/src/FbRootWindow.hh b/src/FbRootWindow.hh
new file mode 100644
index 0000000..687c234
--- /dev/null
+++ b/src/FbRootWindow.hh
@@ -0,0 +1,49 @@
1// FbRootWindow.hh for fluxbox
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id: FbRootWindow.hh,v 1.1 2003/05/10 22:50:19 fluxgen Exp $
23
24#ifndef FBROOTWINDOW_HH
25#define FBROOTWINDOW_HH
26
27#include "FbWindow.hh"
28
29class FbRootWindow: public FbTk::FbWindow {
30public:
31 explicit FbRootWindow(int screen_num);
32 // disable functions that we can't do on root window
33 void move(int x, int y) { }
34 void resize(unsigned int width, unsigned int height) { }
35 void moveResize(int x, int y, unsigned int width, unsigned int height) { }
36 void show() { }
37 void hide() { }
38 // we should not assign a new window to this
39 FbTk::FbWindow &operator = (Window win) { return *this; }
40
41 inline Visual *visual() const { return m_visual; }
42 inline Colormap colormap() const { return m_colormap; }
43
44private:
45 Visual *m_visual;
46 Colormap m_colormap;
47};
48
49#endif // FBROOTWINDOW_HH