aboutsummaryrefslogtreecommitdiff
path: root/src/FbRootWindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbRootWindow.cc')
-rw-r--r--src/FbRootWindow.cc35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/FbRootWindow.cc b/src/FbRootWindow.cc
index 7e2b77e..e329719 100644
--- a/src/FbRootWindow.cc
+++ b/src/FbRootWindow.cc
@@ -27,10 +27,20 @@
27FbRootWindow::FbRootWindow(int screen_num): 27FbRootWindow::FbRootWindow(int screen_num):
28 FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)), 28 FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)),
29 m_visual(0), 29 m_visual(0),
30 m_colormap(0) { 30 m_colormap(0),
31 m_decorationDepth(0),
32 m_decorationVisual(0),
33 m_decorationColormap(0) {
31 34
32 Display *disp = FbTk::App::instance()->display(); 35 Display *disp = FbTk::App::instance()->display();
33 36
37 m_visual = DefaultVisual(disp, screen_num);
38 m_colormap = DefaultColormap(disp, screen_num);
39
40 m_decorationDepth = DefaultDepth(disp, screen_num);
41 m_decorationVisual = DefaultVisual(disp, screen_num);
42 m_decorationColormap = DefaultColormap(disp, screen_num);
43
34 // search for a TrueColor Visual... if we can't find one... we will use the 44 // search for a TrueColor Visual... if we can't find one... we will use the
35 // default visual for the screen 45 // default visual for the screen
36 XVisualInfo vinfo_template, *vinfo_return; 46 XVisualInfo vinfo_template, *vinfo_return;
@@ -44,19 +54,26 @@ FbRootWindow::FbRootWindow(int screen_num):
44 vinfo_nitems > 0) { 54 vinfo_nitems > 0) {
45 55
46 for (int i = 0; i < vinfo_nitems; i++) { 56 for (int i = 0; i < vinfo_nitems; i++) {
47 // We can't handle 32-bit visuals just yet (Composite ARGB) 57 if ((DefaultDepth(disp, screen_num) < vinfo_return[i].depth)
48 if (vinfo_return[i].depth != 32 && DefaultDepth(disp, screen_num) < vinfo_return[i].depth) 58 && (depth() < vinfo_return[i].depth)){
49 m_visual = vinfo_return[i].visual; 59 m_visual = vinfo_return[i].visual;
60 setDepth(vinfo_return[i].depth);
61 }
62
63 if((m_decorationDepth < vinfo_return[i].depth)
64 && (vinfo_return[i].depth != 32)) {
65 m_decorationVisual = vinfo_return[i].visual;
66 m_decorationDepth = vinfo_return[i].depth;
67 }
50 } 68 }
51 69
52 XFree(vinfo_return); 70 XFree(vinfo_return);
53 } 71 }
54 72
55 if (m_visual) { 73 if (m_visual != DefaultVisual(disp, screen_num)) {
56 m_colormap = XCreateColormap(disp, window(), 74 m_colormap = XCreateColormap(disp, window(), m_visual, AllocNone);
57 m_visual, AllocNone); 75 }
58 } else { 76 if (m_decorationVisual != DefaultVisual(disp, screen_num)) {
59 m_visual = DefaultVisual(disp, screen_num); 77 m_decorationColormap = XCreateColormap(disp, window(), m_visual, AllocNone);
60 m_colormap = DefaultColormap(disp, screen_num);
61 } 78 }
62} 79}