HACK around bug 288791 - search for likely panel proxies and raise them after destroying an effect input window

BUG: 288791
REVIEW: 105245
FIXED-IN: 4.9
This commit is contained in:
Thomas Lübking 2012-06-13 21:44:59 +02:00
parent f9d681a3ba
commit b6c84775ab
3 changed files with 58 additions and 0 deletions

View file

@ -985,6 +985,9 @@ void EffectsHandlerImpl::destroyInputWindow(Window w)
if (pos.second == w) {
input_windows.removeAll(pos);
XDestroyWindow(display(), w);
#ifdef KWIN_BUILD_SCREENEDGES
Workspace::self()->screenEdge()->raisePanelProxies();
#endif
return;
}
}

View file

@ -398,6 +398,56 @@ void ScreenEdge::ensureOnTop()
delete [] windows;
}
/*
* NOTICE THIS IS A HACK
* or at least a quite cumbersome way to handle conflictive electric borders
* (like for autohiding panels or whatever)
* the SANE solution is a central electric border daemon and a protocol
* what this function does is to search for windows on the screen edges that are
* * not our own screenedge
* * either very slim
* * or InputOnly
* and raises them on top of everything else, including our own screen borders
* this is typically (and for now ONLY) called when an effect input window is destroyed
* (which raised our electric borders)
*/
void ScreenEdge::raisePanelProxies()
{
XWindowAttributes attr;
Window dummy;
Window* windows = NULL;
unsigned int count = 0;
QRect screen = QRect(0, 0, displayWidth(), displayHeight());
QVector<Window> proxies;
XQueryTree(display(), rootWindow(), &dummy, &dummy, &windows, &count);
for (unsigned int i = 0; i < count; ++i) {
if (m_screenEdgeWindows.contains(windows[i]))
continue;
if (XGetWindowAttributes(display(), windows[i], &attr)) {
if (attr.map_state == IsUnmapped) // a thousand Qt group leader dummies ...
continue;
const QRect geo(attr.x, attr.y, attr.width, attr.height);
if (geo.width() < 1 || geo.height() < 1)
continue;
if (!(geo.width() > 1 || geo.height() > 1))
continue; // random 1x1 dummy windows, all your corners are belong to us >-)
if (attr.c_class != InputOnly && (geo.width() > 3 && geo.height() > 3))
continue;
if (geo.x() != screen.x() && geo.right() != screen.right() &&
geo.y() != screen.y() && geo.bottom() != screen.bottom())
continue;
proxies << windows[i];
}
}
if (!proxies.isEmpty()) {
XRaiseWindow(display(), proxies.data()[ 0 ]);
XRestackWindows(display(), proxies.data(), proxies.count());
}
if (windows)
XFree(windows);
}
const QVector< Window >& ScreenEdge::windows()
{
return m_screenEdgeWindows;

View file

@ -90,6 +90,11 @@ public:
* to do this if an effect input window is active.
*/
void ensureOnTop();
/**
* Raise FOREIGN border windows to the real top of the screen. We usually need
* to do this after an effect input window was active.
*/
void raisePanelProxies();
/**
* Called when the user entered an electric border with the mouse.
* It may switch to another virtual desktop.