summaryrefslogtreecommitdiff
path: root/src/FbTk/FbWindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/FbWindow.cc')
-rw-r--r--src/FbTk/FbWindow.cc29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 2ef24fa..342e968 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -75,7 +75,9 @@ FbWindow::FbWindow(int screen_num,
75 bool override_redirect, 75 bool override_redirect,
76 bool save_unders, 76 bool save_unders,
77 unsigned int depth, 77 unsigned int depth,
78 int class_type): 78 int class_type,
79 Visual *visual,
80 Colormap cmap):
79 FbDrawable(), 81 FbDrawable(),
80 m_parent(0), 82 m_parent(0),
81 m_screen_num(screen_num), 83 m_screen_num(screen_num),
@@ -86,7 +88,7 @@ FbWindow::FbWindow(int screen_num,
86 88
87 create(RootWindow(display(), screen_num), 89 create(RootWindow(display(), screen_num),
88 x, y, width, height, eventmask, 90 x, y, width, height, eventmask,
89 override_redirect, save_unders, depth, class_type); 91 override_redirect, save_unders, depth, class_type, visual, cmap);
90}; 92};
91 93
92FbWindow::FbWindow(const FbWindow &parent, 94FbWindow::FbWindow(const FbWindow &parent,
@@ -101,8 +103,16 @@ FbWindow::FbWindow(const FbWindow &parent,
101 m_lastbg_color_set(false), m_lastbg_color(0), 103 m_lastbg_color_set(false), m_lastbg_color(0),
102 m_lastbg_pm(0), m_renderer(0) { 104 m_lastbg_pm(0), m_renderer(0) {
103 105
106 Visual *visual = DefaultVisual(display(), 0);
107 Colormap cmap = DefaultColormap(display(), 0);
108 if (depth == CopyFromParent) {
109 depth = DefaultDepth(display(), 0);
110 } else {
111 printf("WARNING: Non-standard depth reqested %d\n", depth);
112 }
113
104 create(parent.window(), x, y, width, height, eventmask, 114 create(parent.window(), x, y, width, height, eventmask,
105 override_redirect, save_unders, depth, class_type); 115 override_redirect, save_unders, depth, class_type, visual, cmap);
106 116
107 117
108}; 118};
@@ -603,7 +613,8 @@ bool FbWindow::updateGeometry() {
603void FbWindow::create(Window parent, int x, int y, 613void FbWindow::create(Window parent, int x, int y,
604 unsigned int width, unsigned int height, 614 unsigned int width, unsigned int height,
605 long eventmask, bool override_redirect, 615 long eventmask, bool override_redirect,
606 bool save_unders, unsigned int depth, int class_type) { 616 bool save_unders, unsigned int depth, int class_type,
617 Visual *visual, Colormap cmap) {
607 618
608 619
609 m_border_width = 0; 620 m_border_width = 0;
@@ -623,11 +634,19 @@ void FbWindow::create(Window parent, int x, int y,
623 values.save_under = True; 634 values.save_under = True;
624 } 635 }
625 636
637 if (cmap != CopyFromParent) {
638 valmask |= CWColormap | CWBackPixel | CWBorderPixel;
639 values.colormap = cmap;
640 /* Why do we need to specify these for a 32-bit visual? */
641 values.background_pixel = XWhitePixel(display(), 0);
642 values.border_pixel = XBlackPixel(display(), 0);
643 }
644
626 m_window = XCreateWindow(display(), parent, x, y, width, height, 645 m_window = XCreateWindow(display(), parent, x, y, width, height,
627 0, // border width 646 0, // border width
628 depth, // depth 647 depth, // depth
629 class_type, // class 648 class_type, // class
630 CopyFromParent, // visual 649 visual, // visual
631 valmask, // create mask 650 valmask, // create mask
632 &values); // create atrribs 651 &values); // create atrribs
633 652