From 51956433627918cb6f0fddeb09b1438facd28b25 Mon Sep 17 00:00:00 2001 From: Jim Ramsay Date: Mon, 4 May 2009 15:44:57 -0400 Subject: Let xcompmgr see client windows with ARGB visuals We accomplish this by creating the outer-most parent window of FbWinFrame with a 32-bit visual. Everything else fluxbox does (decor, menus, colors, fonts, etc) is still at most 24-bit (no alpha chanel), for now, by falling back to the screen's default visual and not inheriting directly from the parent FbWinFrame window. --- src/FbRootWindow.cc | 6 ++++-- src/FbTk/FbWindow.cc | 29 ++++++++++++++++++++++++----- src/FbTk/FbWindow.hh | 11 ++++++++--- src/FbWinFrame.cc | 5 ++++- 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): vinfo_nitems > 0) { for (int i = 0; i < vinfo_nitems; i++) { - // We can't handle 32-bit visuals just yet (Composite ARGB) - if (vinfo_return[i].depth != 32 && DefaultDepth(disp, screen_num) < vinfo_return[i].depth) + if (DefaultDepth(disp, screen_num) < vinfo_return[i].depth) { m_visual = vinfo_return[i].visual; + setDepth(vinfo_return[i].depth); + } } XFree(vinfo_return); @@ -58,5 +59,6 @@ FbRootWindow::FbRootWindow(int screen_num): } else { m_visual = DefaultVisual(disp, screen_num); m_colormap = DefaultColormap(disp, screen_num); + setDepth(DefaultDepth(disp, screen_num)); } } 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, bool override_redirect, bool save_unders, unsigned int depth, - int class_type): + int class_type, + Visual *visual, + Colormap cmap): FbDrawable(), m_parent(0), m_screen_num(screen_num), @@ -86,7 +88,7 @@ FbWindow::FbWindow(int screen_num, create(RootWindow(display(), screen_num), x, y, width, height, eventmask, - override_redirect, save_unders, depth, class_type); + override_redirect, save_unders, depth, class_type, visual, cmap); }; FbWindow::FbWindow(const FbWindow &parent, @@ -101,8 +103,16 @@ FbWindow::FbWindow(const FbWindow &parent, m_lastbg_color_set(false), m_lastbg_color(0), m_lastbg_pm(0), m_renderer(0) { + Visual *visual = DefaultVisual(display(), 0); + Colormap cmap = DefaultColormap(display(), 0); + if (depth == CopyFromParent) { + depth = DefaultDepth(display(), 0); + } else { + printf("WARNING: Non-standard depth reqested %d\n", depth); + } + create(parent.window(), x, y, width, height, eventmask, - override_redirect, save_unders, depth, class_type); + override_redirect, save_unders, depth, class_type, visual, cmap); }; @@ -603,7 +613,8 @@ bool FbWindow::updateGeometry() { void FbWindow::create(Window parent, int x, int y, unsigned int width, unsigned int height, long eventmask, bool override_redirect, - bool save_unders, unsigned int depth, int class_type) { + bool save_unders, unsigned int depth, int class_type, + Visual *visual, Colormap cmap) { m_border_width = 0; @@ -623,11 +634,19 @@ void FbWindow::create(Window parent, int x, int y, values.save_under = True; } + if (cmap != CopyFromParent) { + valmask |= CWColormap | CWBackPixel | CWBorderPixel; + values.colormap = cmap; + /* Why do we need to specify these for a 32-bit visual? */ + values.background_pixel = XWhitePixel(display(), 0); + values.border_pixel = XBlackPixel(display(), 0); + } + m_window = XCreateWindow(display(), parent, x, y, width, height, 0, // border width depth, // depth class_type, // class - CopyFromParent, // visual + visual, // visual valmask, // create mask &values); // create atrribs 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: bool overrride_redirect = false, bool save_unders = false, unsigned int depth = CopyFromParent, - int class_type = InputOutput); + int class_type = InputOutput, + Visual *visual = CopyFromParent, + Colormap cmap = CopyFromParent); FbWindow(const FbWindow &parent, int x, int y, @@ -206,6 +208,8 @@ protected: /// creates a window with x window client (m_window = client) explicit FbWindow(Window client); + void setDepth(unsigned int depth) { m_depth = depth; } + private: /// sets new X window and destroys old void setNew(Window win); @@ -215,7 +219,9 @@ private: bool override_redirect, bool save_unders, unsigned int depth, - int class_type); + int class_type, + Visual *visual, + Colormap cmap); const FbWindow *m_parent; ///< parent FbWindow int m_screen_num; ///< screen num on which this window exist @@ -249,7 +255,6 @@ public: virtual ~FbWindowRenderer() { } }; - } // end namespace FbTk #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, m_window(theme->screenNum(), state.x, state.y, state.width, state.height, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | - LeaveWindowMask, true), + LeaveWindowMask, true, false, + screen.rootWindow().depth(), InputOutput, + screen.rootWindow().visual(), + screen.rootWindow().colormap()), m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)), m_titlebar(m_window, 0, 0, 100, 16, ButtonPressMask | ButtonReleaseMask | -- cgit v0.11.2