Integrate patch from jessicah #8937. Thanks!

- navigate in a single S&T group using (win + left and right arrows)
- minor fixed to the patch
- enable switching between S&T groups on the same desktop again (win + up and down arrows)

Hope window key + arrow keys does not collide with to many apps?
This commit is contained in:
czeidler 2012-11-05 22:24:42 +01:00
parent 35ef01c566
commit 24ad8261a9

View File

@ -129,16 +129,42 @@ StackAndTile::KeyPressed(uint32 what, int32 key, int32 modifiers)
if (!wasPressed && fSATKeyPressed)
_StartSAT();
}
// switch off group navigation because it clashes with tracker...
return false;
if (!SATKeyPressed() || (modifiers & B_COMMAND_KEY) == 0
|| what != B_KEY_DOWN)
if (!SATKeyPressed() || what != B_KEY_DOWN)
return false;
const int kArrowKeyUp = 87;
const int kArrowKeyDown = 98;
const int kArrowKeyLeft = 97;
const int kArrowKeyRight = 99;
switch (key) {
case kArrowKeyLeft:
case kArrowKeyRight:
{
SATWindow* frontWindow = GetSATWindow(fDesktop->FocusWindow());
SATGroup* currentGroup = NULL;
if (frontWindow)
currentGroup = frontWindow->GetGroup();
int32 groupSize = currentGroup->CountItems();
if (!currentGroup || groupSize <= 1)
return false;
for (int32 i = 0; i < groupSize; i++) {
SATWindow* targetWindow = currentGroup->WindowAt(i);
if (targetWindow == frontWindow) {
if (key == kArrowKeyLeft && i > 0) {
targetWindow = currentGroup->WindowAt(i - 1);
} else if (key == kArrowKeyRight && i < groupSize - 1) {
targetWindow = currentGroup->WindowAt(i + 1);
}
_ActivateWindow(targetWindow);
return true;
}
}
break;
}
case kArrowKeyDown:
{
SATWindow* frontWindow = GetSATWindow(fDesktop->FocusWindow());