Skip to content

Commit

Permalink
Ignore minimized windows.
Browse files Browse the repository at this point in the history
Fixed a bug where minimized windows weren't being ignored.  Also moved
the ever-growing "window filter" expression into a macro, which
annoyingly requires the server geometry to be passed in.
  • Loading branch information
Scott S. McCoy committed Mar 12, 2015
1 parent a6f995b commit ca6e8e4
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/keynav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,28 @@ KeyboardNavigation::NearestWindow::lateralCollision (CompWindow *window)
throw "Illegal State";
}

#define UNDESIRABLE_WINDOW(window, sg) \
!window->isFocussable() || \
!window->isViewable() || \
!window->isMapped() || \
window->shaded() || \
window->minimized() || \
(window->type() & (CompWindowTypeDesktopMask | \
CompWindowTypeDockMask)) || \
(window->state() & CompWindowStateSkipTaskbarMask) || \
(sg.x() + sg.width() <= 0 || \
sg.y() + sg.height() <= 0 || \
sg.x() >= (int) ::screen->width() || \
sg.y() >= (int) ::screen->height()) || \
!window->onCurrentDesktop()

void
KeyboardNavigation::NearestWindow::inspectWindow (CompWindow *window)
{
const CompWindow::Geometry &sg = window->serverGeometry();

/* This is a completely unmaintainable expression */
if (window->id() == source->id() ||
!window->isFocussable() ||
!window->isViewable() ||
!window->isMapped() ||
window->shaded() ||
(window->type() & (CompWindowTypeDesktopMask |
CompWindowTypeDockMask)) ||
(window->state() & CompWindowStateSkipTaskbarMask) ||
(sg.x() + sg.width() <= 0 ||
sg.y() + sg.height() <= 0 ||
sg.x() >= (int) ::screen->width() ||
sg.y() >= (int) ::screen->height()) ||
!window->onCurrentDesktop())
{
if (window->id() == source->id() || UNDESIRABLE_WINDOW(window, sg)) {
DEBUG_LOG("Ignoring window " << window->id());
return;
}
Expand Down

0 comments on commit ca6e8e4

Please sign in to comment.