diff options
Diffstat (limited to 'src/FbRootWindow.cc')
-rw-r--r-- | src/FbRootWindow.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/FbRootWindow.cc b/src/FbRootWindow.cc index 7e2b77e..1d92441 100644 --- a/src/FbRootWindow.cc +++ b/src/FbRootWindow.cc | |||
@@ -24,10 +24,13 @@ | |||
24 | #include "FbTk/App.hh" | 24 | #include "FbTk/App.hh" |
25 | #include <X11/Xutil.h> | 25 | #include <X11/Xutil.h> |
26 | 26 | ||
27 | #include <iostream> | ||
28 | |||
27 | FbRootWindow::FbRootWindow(int screen_num): | 29 | FbRootWindow::FbRootWindow(int screen_num): |
28 | FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)), | 30 | FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)), |
29 | m_visual(0), | 31 | m_visual(0), |
30 | m_colormap(0) { | 32 | m_colormap(0), |
33 | m_depth(0) { | ||
31 | 34 | ||
32 | Display *disp = FbTk::App::instance()->display(); | 35 | Display *disp = FbTk::App::instance()->display(); |
33 | 36 | ||
@@ -44,9 +47,13 @@ FbRootWindow::FbRootWindow(int screen_num): | |||
44 | vinfo_nitems > 0) { | 47 | vinfo_nitems > 0) { |
45 | 48 | ||
46 | for (int i = 0; i < vinfo_nitems; i++) { | 49 | for (int i = 0; i < vinfo_nitems; i++) { |
47 | // We can't handle 32-bit visuals just yet (Composite ARGB) | 50 | if (DefaultDepth(disp, screen_num) < vinfo_return[i].depth) { |
48 | if (vinfo_return[i].depth != 32 && DefaultDepth(disp, screen_num) < vinfo_return[i].depth) | ||
49 | m_visual = vinfo_return[i].visual; | 51 | m_visual = vinfo_return[i].visual; |
52 | m_depth = vinfo_return[i].depth; | ||
53 | fprintf(stderr, "visual 0x%02x with depth %d\n", | ||
54 | (unsigned)XVisualIDFromVisual(m_visual), | ||
55 | m_depth); | ||
56 | } | ||
50 | } | 57 | } |
51 | 58 | ||
52 | XFree(vinfo_return); | 59 | XFree(vinfo_return); |
@@ -55,8 +62,12 @@ FbRootWindow::FbRootWindow(int screen_num): | |||
55 | if (m_visual) { | 62 | if (m_visual) { |
56 | m_colormap = XCreateColormap(disp, window(), | 63 | m_colormap = XCreateColormap(disp, window(), |
57 | m_visual, AllocNone); | 64 | m_visual, AllocNone); |
65 | FbTk::App::instance()->registerScreenDefaults(screen_num, m_visual, m_colormap, m_depth); | ||
58 | } else { | 66 | } else { |
59 | m_visual = DefaultVisual(disp, screen_num); | 67 | m_visual = DefaultVisual(disp, screen_num); |
60 | m_colormap = DefaultColormap(disp, screen_num); | 68 | m_colormap = DefaultColormap(disp, screen_num); |
69 | m_depth = DefaultDepth(disp, screen_num); | ||
70 | fprintf(stderr, "Falling back to default visual 0x%02x\n", | ||
71 | (unsigned)XVisualIDFromVisual(m_visual)); | ||
61 | } | 72 | } |
62 | } | 73 | } |