diff options
Diffstat (limited to 'src/FbTk/FbWindow.cc')
-rw-r--r-- | src/FbTk/FbWindow.cc | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 2ef24fa..e1b27cd 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc | |||
@@ -72,9 +72,11 @@ FbWindow::FbWindow(int screen_num, | |||
72 | int x, int y, | 72 | int x, int y, |
73 | unsigned int width, unsigned int height, | 73 | unsigned int width, unsigned int height, |
74 | long eventmask, | 74 | long eventmask, |
75 | Visual *visual, | ||
76 | Colormap cmap, | ||
77 | unsigned int depth, | ||
75 | bool override_redirect, | 78 | bool override_redirect, |
76 | bool save_unders, | 79 | bool save_unders, |
77 | unsigned int depth, | ||
78 | int class_type): | 80 | int class_type): |
79 | FbDrawable(), | 81 | FbDrawable(), |
80 | m_parent(0), | 82 | m_parent(0), |
@@ -84,9 +86,18 @@ FbWindow::FbWindow(int screen_num, | |||
84 | m_lastbg_color(0), | 86 | m_lastbg_color(0), |
85 | m_lastbg_pm(0), m_renderer(0) { | 87 | m_lastbg_pm(0), m_renderer(0) { |
86 | 88 | ||
89 | XWindowAttributes a; | ||
90 | if (XGetWindowAttributes(display(), RootWindow(display(), screen_num), &a)) { | ||
91 | printf("Creating screen window. RootWindow visual is 0x%02x, requested visual is 0x%02x\n", | ||
92 | (unsigned int)XVisualIDFromVisual(a.visual), | ||
93 | visual == CopyFromParent ? 0xff : (unsigned int)XVisualIDFromVisual(visual)); | ||
94 | } else { | ||
95 | printf("Creating screen window. RootWindow visual is unknown, requested visual is 0x%02x\n", | ||
96 | visual == CopyFromParent ? 0xff : (unsigned int)XVisualIDFromVisual(visual)); | ||
97 | } | ||
87 | create(RootWindow(display(), screen_num), | 98 | create(RootWindow(display(), screen_num), |
88 | x, y, width, height, eventmask, | 99 | x, y, width, height, eventmask, |
89 | override_redirect, save_unders, depth, class_type); | 100 | override_redirect, save_unders, depth, class_type, visual, cmap); |
90 | }; | 101 | }; |
91 | 102 | ||
92 | FbWindow::FbWindow(const FbWindow &parent, | 103 | FbWindow::FbWindow(const FbWindow &parent, |
@@ -102,7 +113,7 @@ FbWindow::FbWindow(const FbWindow &parent, | |||
102 | m_lastbg_pm(0), m_renderer(0) { | 113 | m_lastbg_pm(0), m_renderer(0) { |
103 | 114 | ||
104 | create(parent.window(), x, y, width, height, eventmask, | 115 | create(parent.window(), x, y, width, height, eventmask, |
105 | override_redirect, save_unders, depth, class_type); | 116 | override_redirect, save_unders, depth, class_type, CopyFromParent); |
106 | 117 | ||
107 | 118 | ||
108 | }; | 119 | }; |
@@ -603,7 +614,8 @@ bool FbWindow::updateGeometry() { | |||
603 | void FbWindow::create(Window parent, int x, int y, | 614 | void FbWindow::create(Window parent, int x, int y, |
604 | unsigned int width, unsigned int height, | 615 | unsigned int width, unsigned int height, |
605 | long eventmask, bool override_redirect, | 616 | long eventmask, bool override_redirect, |
606 | bool save_unders, unsigned int depth, int class_type) { | 617 | bool save_unders, unsigned int depth, int class_type, |
618 | Visual *visual, Colormap cmap) { | ||
607 | 619 | ||
608 | 620 | ||
609 | m_border_width = 0; | 621 | m_border_width = 0; |
@@ -623,13 +635,28 @@ void FbWindow::create(Window parent, int x, int y, | |||
623 | values.save_under = True; | 635 | values.save_under = True; |
624 | } | 636 | } |
625 | 637 | ||
638 | if (cmap) { | ||
639 | valmask |= CWColormap | CWBackPixel | CWBorderPixel; | ||
640 | values.colormap = cmap; | ||
641 | /* For some reason, with a 32-bit visual, we need to set these */ | ||
642 | values.background_pixel = XWhitePixel(display(), 0); | ||
643 | values.border_pixel = XBlackPixel(display(), 0); | ||
644 | } | ||
645 | |||
646 | if (depth > 0 || cmap || visual) | ||
647 | printf("Creating window... depth %d, cmap %p, visual 0x%02x (%p)\n", | ||
648 | depth, (void*)cmap, | ||
649 | visual == CopyFromParent ? 0xff : (unsigned int)XVisualIDFromVisual(visual), | ||
650 | visual); | ||
626 | m_window = XCreateWindow(display(), parent, x, y, width, height, | 651 | m_window = XCreateWindow(display(), parent, x, y, width, height, |
627 | 0, // border width | 652 | 0, // border width |
628 | depth, // depth | 653 | depth, // depth |
629 | class_type, // class | 654 | class_type, // class |
630 | CopyFromParent, // visual | 655 | visual, // visual |
631 | valmask, // create mask | 656 | valmask, // create mask |
632 | &values); // create atrribs | 657 | &values); // create atrribs |
658 | if (depth > 0 || cmap || visual) | ||
659 | printf(" Complete\n"); | ||
633 | 660 | ||
634 | assert(m_window); | 661 | assert(m_window); |
635 | 662 | ||