summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <i.am@jimramsay.com>2009-05-04 19:44:57 (GMT)
committerJim Ramsay <i.am@jimramsay.com>2009-05-04 19:44:57 (GMT)
commitba14331411cc54c85c7ae9c6380fa37145771d7f (patch)
treed60aa8dc4a0f27bafe9b564c2aac311ed54da7ae
parentdfa360e8905509e3e19db4279fc4066e52014676 (diff)
downloadfluxbox_lack-ba14331411cc54c85c7ae9c6380fa37145771d7f.zip
fluxbox_lack-ba14331411cc54c85c7ae9c6380fa37145771d7f.tar.bz2
Frame is now 32-bit depth
Decor is still 24-bit, for now.
-rw-r--r--src/FbRootWindow.cc6
-rw-r--r--src/FbTk/FbWindow.cc29
-rw-r--r--src/FbTk/FbWindow.hh11
-rw-r--r--src/FbWinFrame.cc5
4 files changed, 40 insertions, 11 deletions
diff --git a/src/FbRootWindow.cc b/src/FbRootWindow.cc
index 7e2b77e..b5db823 100644
--- a/src/FbRootWindow.cc
+++ b/src/FbRootWindow.cc
@@ -44,9 +44,10 @@ FbRootWindow::FbRootWindow(int screen_num):
44 vinfo_nitems > 0) { 44 vinfo_nitems > 0) {
45 45
46 for (int i = 0; i < vinfo_nitems; i++) { 46 for (int i = 0; i < vinfo_nitems; i++) {
47 // We can't handle 32-bit visuals just yet (Composite ARGB) 47 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; 48 m_visual = vinfo_return[i].visual;
49 setDepth(vinfo_return[i].depth);
50 }
50 } 51 }
51 52
52 XFree(vinfo_return); 53 XFree(vinfo_return);
@@ -58,5 +59,6 @@ FbRootWindow::FbRootWindow(int screen_num):
58 } else { 59 } else {
59 m_visual = DefaultVisual(disp, screen_num); 60 m_visual = DefaultVisual(disp, screen_num);
60 m_colormap = DefaultColormap(disp, screen_num); 61 m_colormap = DefaultColormap(disp, screen_num);
62 setDepth(DefaultDepth(disp, screen_num));
61 } 63 }
62} 64}
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
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 2975252..ac457be 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -51,7 +51,10 @@ FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state,
51 m_window(theme->screenNum(), state.x, state.y, state.width, state.height, 51 m_window(theme->screenNum(), state.x, state.y, state.width, state.height,
52 ButtonPressMask | ButtonReleaseMask | 52 ButtonPressMask | ButtonReleaseMask |
53 ButtonMotionMask | EnterWindowMask | 53 ButtonMotionMask | EnterWindowMask |
54 LeaveWindowMask, true), 54 LeaveWindowMask, true, false,
55 screen.rootWindow().depth(), InputOutput,
56 screen.rootWindow().visual(),
57 screen.rootWindow().colormap()),
55 m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)), 58 m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)),
56 m_titlebar(m_window, 0, 0, 100, 16, 59 m_titlebar(m_window, 0, 0, 100, 16,
57 ButtonPressMask | ButtonReleaseMask | 60 ButtonPressMask | ButtonReleaseMask |