Added support for ARGB visual, patch #3284774
fluxbox now properly displays windows that require ARGB visuals when an external compositor is running. This was done by creating the container window with the correct visual and colormap when needed. Closes #2874629
This commit is contained in:
parent
b2b65dea7f
commit
12f44680df
7 changed files with 90 additions and 32 deletions
|
@ -27,10 +27,20 @@
|
||||||
FbRootWindow::FbRootWindow(int screen_num):
|
FbRootWindow::FbRootWindow(int screen_num):
|
||||||
FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)),
|
FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)),
|
||||||
m_visual(0),
|
m_visual(0),
|
||||||
m_colormap(0) {
|
m_colormap(0),
|
||||||
|
m_decorationDepth(0),
|
||||||
|
m_decorationVisual(0),
|
||||||
|
m_decorationColormap(0) {
|
||||||
|
|
||||||
Display *disp = FbTk::App::instance()->display();
|
Display *disp = FbTk::App::instance()->display();
|
||||||
|
|
||||||
|
m_visual = DefaultVisual(disp, screen_num);
|
||||||
|
m_colormap = DefaultColormap(disp, screen_num);
|
||||||
|
|
||||||
|
m_decorationDepth = DefaultDepth(disp, screen_num);
|
||||||
|
m_decorationVisual = DefaultVisual(disp, screen_num);
|
||||||
|
m_decorationColormap = DefaultColormap(disp, screen_num);
|
||||||
|
|
||||||
// search for a TrueColor Visual... if we can't find one... we will use the
|
// search for a TrueColor Visual... if we can't find one... we will use the
|
||||||
// default visual for the screen
|
// default visual for the screen
|
||||||
XVisualInfo vinfo_template, *vinfo_return;
|
XVisualInfo vinfo_template, *vinfo_return;
|
||||||
|
@ -44,19 +54,26 @@ FbRootWindow::FbRootWindow(int screen_num):
|
||||||
vinfo_nitems > 0) {
|
vinfo_nitems > 0) {
|
||||||
|
|
||||||
for (int i = 0; i < vinfo_nitems; i++) {
|
for (int i = 0; i < vinfo_nitems; i++) {
|
||||||
// We can't handle 32-bit visuals just yet (Composite ARGB)
|
if ((DefaultDepth(disp, screen_num) < vinfo_return[i].depth)
|
||||||
if (vinfo_return[i].depth != 32 && DefaultDepth(disp, screen_num) < vinfo_return[i].depth)
|
&& (depth() < vinfo_return[i].depth)){
|
||||||
m_visual = vinfo_return[i].visual;
|
m_visual = vinfo_return[i].visual;
|
||||||
|
setDepth(vinfo_return[i].depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((m_decorationDepth < vinfo_return[i].depth)
|
||||||
|
&& (vinfo_return[i].depth != 32)) {
|
||||||
|
m_decorationVisual = vinfo_return[i].visual;
|
||||||
|
m_decorationDepth = vinfo_return[i].depth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree(vinfo_return);
|
XFree(vinfo_return);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_visual) {
|
if (m_visual != DefaultVisual(disp, screen_num)) {
|
||||||
m_colormap = XCreateColormap(disp, window(),
|
m_colormap = XCreateColormap(disp, window(), m_visual, AllocNone);
|
||||||
m_visual, AllocNone);
|
}
|
||||||
} else {
|
if (m_decorationVisual != DefaultVisual(disp, screen_num)) {
|
||||||
m_visual = DefaultVisual(disp, screen_num);
|
m_decorationColormap = XCreateColormap(disp, window(), m_visual, AllocNone);
|
||||||
m_colormap = DefaultColormap(disp, screen_num);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,17 @@ public:
|
||||||
Visual *visual() const { return m_visual; }
|
Visual *visual() const { return m_visual; }
|
||||||
Colormap colormap() const { return m_colormap; }
|
Colormap colormap() const { return m_colormap; }
|
||||||
|
|
||||||
|
int decorationDepth() const { return m_decorationDepth; }
|
||||||
|
Visual *decorationVisual() const { return m_decorationVisual; }
|
||||||
|
Colormap decorationColormap() const { return m_decorationColormap; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Visual *m_visual;
|
Visual *m_visual;
|
||||||
Colormap m_colormap;
|
Colormap m_colormap;
|
||||||
|
|
||||||
|
int m_decorationDepth;
|
||||||
|
Visual *m_decorationVisual;
|
||||||
|
Colormap m_decorationColormap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FBROOTWINDOW_HH
|
#endif // FBROOTWINDOW_HH
|
||||||
|
|
|
@ -77,7 +77,9 @@ FbWindow::FbWindow(int screen_num,
|
||||||
bool override_redirect,
|
bool override_redirect,
|
||||||
bool save_unders,
|
bool save_unders,
|
||||||
unsigned int depth,
|
unsigned int depth,
|
||||||
int class_type):
|
int class_type,
|
||||||
|
Visual *visual,
|
||||||
|
Colormap cmap):
|
||||||
FbDrawable(),
|
FbDrawable(),
|
||||||
m_parent(0),
|
m_parent(0),
|
||||||
m_screen_num(screen_num),
|
m_screen_num(screen_num),
|
||||||
|
@ -93,7 +95,7 @@ FbWindow::FbWindow(int screen_num,
|
||||||
|
|
||||||
create(RootWindow(display(), screen_num),
|
create(RootWindow(display(), screen_num),
|
||||||
x, y, width, height, eventmask,
|
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,
|
FbWindow::FbWindow(const FbWindow &parent,
|
||||||
|
@ -101,7 +103,10 @@ FbWindow::FbWindow(const FbWindow &parent,
|
||||||
long eventmask,
|
long eventmask,
|
||||||
bool override_redirect,
|
bool override_redirect,
|
||||||
bool save_unders,
|
bool save_unders,
|
||||||
unsigned int depth, int class_type):
|
unsigned int depth,
|
||||||
|
int class_type,
|
||||||
|
Visual *visual,
|
||||||
|
Colormap cmap):
|
||||||
FbDrawable(),
|
FbDrawable(),
|
||||||
m_parent(&parent),
|
m_parent(&parent),
|
||||||
m_screen_num(parent.screenNumber()),
|
m_screen_num(parent.screenNumber()),
|
||||||
|
@ -113,9 +118,7 @@ FbWindow::FbWindow(const FbWindow &parent,
|
||||||
m_lastbg_pm(0), m_renderer(0) {
|
m_lastbg_pm(0), m_renderer(0) {
|
||||||
|
|
||||||
create(parent.window(), x, y, width, height, eventmask,
|
create(parent.window(), x, y, width, height, eventmask,
|
||||||
override_redirect, save_unders, depth, class_type);
|
override_redirect, save_unders, depth, class_type, visual, cmap);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FbWindow::FbWindow(Window client):
|
FbWindow::FbWindow(Window client):
|
||||||
|
@ -634,9 +637,8 @@ bool FbWindow::updateGeometry() {
|
||||||
void FbWindow::create(Window parent, int x, int y,
|
void FbWindow::create(Window parent, int x, int y,
|
||||||
unsigned int width, unsigned int height,
|
unsigned int width, unsigned int height,
|
||||||
long eventmask, bool override_redirect,
|
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;
|
m_border_width = 0;
|
||||||
m_border_color = 0;
|
m_border_color = 0;
|
||||||
|
|
||||||
|
@ -654,11 +656,18 @@ void FbWindow::create(Window parent, int x, int y,
|
||||||
values.save_under = True;
|
values.save_under = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmap != CopyFromParent) {
|
||||||
|
valmask |= CWColormap | CWBackPixel | CWBorderPixel;
|
||||||
|
values.colormap = cmap;
|
||||||
|
values.background_pixel = XWhitePixel(display(), 0);
|
||||||
|
values.border_pixel = XBlackPixel(display(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
m_window = XCreateWindow(display(), parent, x, y, width, height,
|
m_window = XCreateWindow(display(), parent, x, y, width, height,
|
||||||
0, // border width
|
0, // border width
|
||||||
depth, // depth
|
depth, // depth
|
||||||
class_type, // class
|
class_type, // class
|
||||||
CopyFromParent, // visual
|
visual, // visual
|
||||||
valmask, // create mask
|
valmask, // create mask
|
||||||
&values); // create atrribs
|
&values); // create atrribs
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,9 @@ public:
|
||||||
bool overrride_redirect = false,
|
bool overrride_redirect = false,
|
||||||
bool save_unders = false,
|
bool save_unders = false,
|
||||||
unsigned int depth = CopyFromParent,
|
unsigned int depth = CopyFromParent,
|
||||||
int class_type = InputOutput);
|
int class_type = InputOutput,
|
||||||
|
Visual *visual = CopyFromParent,
|
||||||
|
Colormap cmap = CopyFromParent);
|
||||||
|
|
||||||
FbWindow(const FbWindow &parent,
|
FbWindow(const FbWindow &parent,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
|
@ -66,7 +68,9 @@ public:
|
||||||
bool overrride_redirect = false,
|
bool overrride_redirect = false,
|
||||||
bool save_unders = false,
|
bool save_unders = false,
|
||||||
unsigned int depth = CopyFromParent,
|
unsigned int depth = CopyFromParent,
|
||||||
int class_type = InputOutput);
|
int class_type = InputOutput,
|
||||||
|
Visual *visual = CopyFromParent,
|
||||||
|
Colormap cmap = CopyFromParent);
|
||||||
|
|
||||||
virtual ~FbWindow();
|
virtual ~FbWindow();
|
||||||
virtual void setBackgroundColor(const FbTk::Color &bg_color);
|
virtual void setBackgroundColor(const FbTk::Color &bg_color);
|
||||||
|
@ -207,6 +211,8 @@ protected:
|
||||||
/// creates a window with x window client (m_window = client)
|
/// creates a window with x window client (m_window = client)
|
||||||
explicit FbWindow(Window client);
|
explicit FbWindow(Window client);
|
||||||
|
|
||||||
|
void setDepth(unsigned int depth) { m_depth = depth; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// sets new X window and destroys old
|
/// sets new X window and destroys old
|
||||||
void setNew(Window win);
|
void setNew(Window win);
|
||||||
|
@ -216,7 +222,9 @@ private:
|
||||||
bool override_redirect,
|
bool override_redirect,
|
||||||
bool save_unders,
|
bool save_unders,
|
||||||
unsigned int depth,
|
unsigned int depth,
|
||||||
int class_type);
|
int class_type,
|
||||||
|
Visual *visual,
|
||||||
|
Colormap cmap);
|
||||||
|
|
||||||
const FbWindow *m_parent; ///< parent FbWindow
|
const FbWindow *m_parent; ///< parent FbWindow
|
||||||
int m_screen_num; ///< screen num on which this window exist
|
int m_screen_num; ///< screen num on which this window exist
|
||||||
|
|
|
@ -45,7 +45,8 @@ using std::string;
|
||||||
|
|
||||||
using FbTk::STLUtil::forAll;
|
using FbTk::STLUtil::forAll;
|
||||||
|
|
||||||
FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state,
|
FbWinFrame::FbWinFrame(BScreen &screen, unsigned int client_depth,
|
||||||
|
WindowState &state,
|
||||||
FocusableTheme<FbWinFrameTheme> &theme):
|
FocusableTheme<FbWinFrameTheme> &theme):
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_theme(theme),
|
m_theme(theme),
|
||||||
|
@ -54,26 +55,41 @@ FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state,
|
||||||
m_window(theme->screenNum(), state.x, state.y, state.width, state.height,
|
m_window(theme->screenNum(), state.x, state.y, state.width, state.height,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | EnterWindowMask |
|
ButtonMotionMask | EnterWindowMask |
|
||||||
LeaveWindowMask, true),
|
LeaveWindowMask, true, false,
|
||||||
|
client_depth, InputOutput,
|
||||||
|
((client_depth == 32) && (screen.rootWindow().depth() == 32) ? screen.rootWindow().visual() : CopyFromParent),
|
||||||
|
((client_depth == 32) && (screen.rootWindow().depth() == 32) ? screen.rootWindow().colormap() : CopyFromParent)),
|
||||||
m_layeritem(window(), *screen.layerManager().getLayer(ResourceLayer::NORMAL)),
|
m_layeritem(window(), *screen.layerManager().getLayer(ResourceLayer::NORMAL)),
|
||||||
m_titlebar(m_window, 0, 0, 100, 16,
|
m_titlebar(m_window, 0, 0, 100, 16,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
EnterWindowMask | LeaveWindowMask),
|
EnterWindowMask | LeaveWindowMask,
|
||||||
|
false, false, screen.rootWindow().decorationDepth(), InputOutput,
|
||||||
|
screen.rootWindow().decorationVisual(),
|
||||||
|
screen.rootWindow().decorationColormap()),
|
||||||
m_tab_container(m_titlebar),
|
m_tab_container(m_titlebar),
|
||||||
m_label(m_titlebar, m_theme->font(), FbTk::BiDiString("")),
|
m_label(m_titlebar, m_theme->font(), FbTk::BiDiString("")),
|
||||||
m_handle(m_window, 0, 0, 100, 5,
|
m_handle(m_window, 0, 0, 100, 5,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
EnterWindowMask | LeaveWindowMask),
|
EnterWindowMask | LeaveWindowMask,
|
||||||
|
false, false, screen.rootWindow().decorationDepth(), InputOutput,
|
||||||
|
screen.rootWindow().decorationVisual(),
|
||||||
|
screen.rootWindow().decorationColormap()),
|
||||||
m_grip_right(m_handle, 0, 0, 10, 4,
|
m_grip_right(m_handle, 0, 0, 10, 4,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
EnterWindowMask | LeaveWindowMask),
|
EnterWindowMask | LeaveWindowMask,
|
||||||
|
false, false, screen.rootWindow().decorationDepth(), InputOutput,
|
||||||
|
screen.rootWindow().decorationVisual(),
|
||||||
|
screen.rootWindow().decorationColormap()),
|
||||||
m_grip_left(m_handle, 0, 0, 10, 4,
|
m_grip_left(m_handle, 0, 0, 10, 4,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
EnterWindowMask | LeaveWindowMask),
|
EnterWindowMask | LeaveWindowMask,
|
||||||
|
false, false, screen.rootWindow().decorationDepth(), InputOutput,
|
||||||
|
screen.rootWindow().decorationVisual(),
|
||||||
|
screen.rootWindow().decorationColormap()),
|
||||||
m_clientarea(m_window, 0, 0, 100, 100,
|
m_clientarea(m_window, 0, 0, 100, 100,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// create a top level window
|
/// create a top level window
|
||||||
FbWinFrame(BScreen &screen, WindowState &state,
|
FbWinFrame(BScreen &screen, unsigned int client_depth, WindowState &state,
|
||||||
FocusableTheme<FbWinFrameTheme> &theme);
|
FocusableTheme<FbWinFrameTheme> &theme);
|
||||||
|
|
||||||
/* /// create a frame window inside another FbWindow, NOT IMPLEMENTED!
|
/* /// create a frame window inside another FbWindow, NOT IMPLEMENTED!
|
||||||
|
|
|
@ -281,7 +281,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
|
||||||
screen().unfocusedWinButtonTheme()),
|
screen().unfocusedWinButtonTheme()),
|
||||||
m_theme(*this, screen().focusedWinFrameTheme(),
|
m_theme(*this, screen().focusedWinFrameTheme(),
|
||||||
screen().unfocusedWinFrameTheme()),
|
screen().unfocusedWinFrameTheme()),
|
||||||
m_frame(client.screen(), m_state, m_theme),
|
m_frame(client.screen(), client.depth(), m_state, m_theme),
|
||||||
m_placed(false),
|
m_placed(false),
|
||||||
m_old_layernum(0),
|
m_old_layernum(0),
|
||||||
m_parent(client.screen().rootWindow()),
|
m_parent(client.screen().rootWindow()),
|
||||||
|
|
Loading…
Reference in a new issue