replace FbRootWindow::depth with maxDepth

The depth member of FbWindow was abused to store the maximum depth
but that gets overridden with geometry changes of the root window
(screen layout changes) so we store and read the value explicitly while
::depth() maintains the actual depth of the root window

The result of this is that frames for ARGB windows were created with a
wrong depth and failed to reparent the client window.

BUG: 1102
BUG: 1058
This commit is contained in:
Thomas Lübking 2016-06-25 22:25:48 +02:00 committed by Mathias Gumz
parent 484c33bf25
commit dcdde4d32c
4 changed files with 9 additions and 6 deletions

View file

@ -30,7 +30,8 @@ FbRootWindow::FbRootWindow(int screen_num):
m_colormap(0), m_colormap(0),
m_decorationDepth(0), m_decorationDepth(0),
m_decorationVisual(0), m_decorationVisual(0),
m_decorationColormap(0) { m_decorationColormap(0),
m_maxDepth(depth()) {
Display *disp = FbTk::App::instance()->display(); Display *disp = FbTk::App::instance()->display();
@ -55,9 +56,9 @@ FbRootWindow::FbRootWindow(int screen_num):
for (int i = 0; i < vinfo_nitems; i++) { for (int i = 0; i < vinfo_nitems; i++) {
if ((DefaultDepth(disp, screen_num) < vinfo_return[i].depth) if ((DefaultDepth(disp, screen_num) < vinfo_return[i].depth)
&& (static_cast<int>(depth()) < vinfo_return[i].depth)){ && (m_maxDepth < vinfo_return[i].depth)){
m_visual = vinfo_return[i].visual; m_visual = vinfo_return[i].visual;
setDepth(vinfo_return[i].depth); m_maxDepth = vinfo_return[i].depth;
} }
if((m_decorationDepth < vinfo_return[i].depth) if((m_decorationDepth < vinfo_return[i].depth)

View file

@ -41,6 +41,7 @@ public:
int decorationDepth() const { return m_decorationDepth; } int decorationDepth() const { return m_decorationDepth; }
Visual *decorationVisual() const { return m_decorationVisual; } Visual *decorationVisual() const { return m_decorationVisual; }
Colormap decorationColormap() const { return m_decorationColormap; } Colormap decorationColormap() const { return m_decorationColormap; }
int maxDepth() const { return m_maxDepth; }
private: private:
Visual *m_visual; Visual *m_visual;
@ -49,6 +50,7 @@ private:
int m_decorationDepth; int m_decorationDepth;
Visual *m_decorationVisual; Visual *m_decorationVisual;
Colormap m_decorationColormap; Colormap m_decorationColormap;
int m_maxDepth;
}; };
#endif // FBROOTWINDOW_HH #endif // FBROOTWINDOW_HH

View file

@ -115,8 +115,8 @@ FbWinFrame::FbWinFrame(BScreen &screen, unsigned int client_depth,
m_state(state), m_state(state),
m_window(theme->screenNum(), state.x, state.y, state.width, state.height, s_mask, true, false, m_window(theme->screenNum(), state.x, state.y, state.width, state.height, s_mask, true, false,
client_depth, InputOutput, client_depth, InputOutput,
((client_depth == 32) && (screen.rootWindow().depth() == 32) ? screen.rootWindow().visual() : CopyFromParent), (client_depth == screen.rootWindow().maxDepth() ? screen.rootWindow().visual() : CopyFromParent),
((client_depth == 32) && (screen.rootWindow().depth() == 32) ? screen.rootWindow().colormap() : CopyFromParent)), (client_depth == screen.rootWindow().maxDepth() ? 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, s_mask, false, false, m_titlebar(m_window, 0, 0, 100, 16, s_mask, false, false,
screen.rootWindow().decorationDepth(), InputOutput, screen.rootWindow().decorationDepth(), InputOutput,

View file

@ -297,7 +297,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
"using visual 0x%lx, depth %d\n", "using visual 0x%lx, depth %d\n",
"informational message saying screen number (%d), visual (%lx), and colour depth (%d)").c_str(), "informational message saying screen number (%d), visual (%lx), and colour depth (%d)").c_str(),
screenNumber(), XVisualIDFromVisual(rootWindow().visual()), screenNumber(), XVisualIDFromVisual(rootWindow().visual()),
rootWindow().depth()); rootWindow().maxDepth());
#endif // DEBUG #endif // DEBUG
FbTk::EventManager *evm = FbTk::EventManager::instance(); FbTk::EventManager *evm = FbTk::EventManager::instance();