summaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/FbWindow.cc29
-rw-r--r--src/FbTk/FbWindow.hh11
2 files changed, 32 insertions, 8 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
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index edeffe1..b9f5e18 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -57,7 +57,9 @@ public:
57 bool overrride_redirect = false, 57 bool overrride_redirect = false,
58 bool save_unders = false, 58 bool save_unders = false,
59 unsigned int depth = CopyFromParent, 59 unsigned int depth = CopyFromParent,
60 int class_type = InputOutput); 60 int class_type = InputOutput,
61 Visual *visual = CopyFromParent,
62 Colormap cmap = CopyFromParent);
61 63
62 FbWindow(const FbWindow &parent, 64 FbWindow(const FbWindow &parent,
63 int x, int y, 65 int x, int y,
@@ -206,6 +208,8 @@ protected:
206 /// creates a window with x window client (m_window = client) 208 /// creates a window with x window client (m_window = client)
207 explicit FbWindow(Window client); 209 explicit FbWindow(Window client);
208 210
211 void setDepth(unsigned int depth) { m_depth = depth; }
212
209private: 213private:
210 /// sets new X window and destroys old 214 /// sets new X window and destroys old
211 void setNew(Window win); 215 void setNew(Window win);
@@ -215,7 +219,9 @@ private:
215 bool override_redirect, 219 bool override_redirect,
216 bool save_unders, 220 bool save_unders,
217 unsigned int depth, 221 unsigned int depth,
218 int class_type); 222 int class_type,
223 Visual *visual,
224 Colormap cmap);
219 225
220 const FbWindow *m_parent; ///< parent FbWindow 226 const FbWindow *m_parent; ///< parent FbWindow
221 int m_screen_num; ///< screen num on which this window exist 227 int m_screen_num; ///< screen num on which this window exist
@@ -249,7 +255,6 @@ public:
249 virtual ~FbWindowRenderer() { } 255 virtual ~FbWindowRenderer() { }
250}; 256};
251 257
252
253} // end namespace FbTk 258} // end namespace FbTk
254 259
255#endif // FBTK_FBWINDOW_HH 260#endif // FBTK_FBWINDOW_HH