- Give the option for the desktop listener to "absorb" key events.
- Make the S&T groups navigateable by pressing the S&T key + arrow down/up. Arrow down means to send the active S&T group to the bottom. Arrow up means to rise the bottom S&T group to the front. If no S&T group is selected, in both cases the front-most S&T group is activated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39751 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -113,7 +113,7 @@ StackAndTile::WindowRemoved(Window* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
bool
|
||||||
StackAndTile::KeyPressed(uint32 what, int32 key, int32 modifiers)
|
StackAndTile::KeyPressed(uint32 what, int32 key, int32 modifiers)
|
||||||
{
|
{
|
||||||
// switch to and from stacking and snapping mode
|
// switch to and from stacking and snapping mode
|
||||||
@@ -126,7 +126,83 @@ StackAndTile::KeyPressed(uint32 what, int32 key, int32 modifiers)
|
|||||||
_StartSAT();
|
_StartSAT();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
if (!SATKeyPressed() || what != B_KEY_DOWN)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const int kArrowKeyUp = 87;
|
||||||
|
const int kArrowKeyDown = 98;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case kArrowKeyDown:
|
||||||
|
{
|
||||||
|
SATWindow* frontWindow = GetSATWindow(fDesktop->FocusWindow());
|
||||||
|
SATGroup* currentGroup = NULL;
|
||||||
|
if (frontWindow)
|
||||||
|
currentGroup = frontWindow->GetGroup();
|
||||||
|
if (currentGroup && currentGroup->CountItems() <= 1)
|
||||||
|
currentGroup = NULL;
|
||||||
|
|
||||||
|
GroupIterator groups(this, fDesktop);
|
||||||
|
bool currentFound = false;
|
||||||
|
while (true) {
|
||||||
|
SATGroup* group = groups.NextGroup();
|
||||||
|
if (group == NULL)
|
||||||
|
break;
|
||||||
|
if (group->CountItems() <= 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (currentGroup == NULL)
|
||||||
|
currentFound = true;
|
||||||
|
// if no group is selected just activate the first one
|
||||||
|
else if (currentGroup == group) {
|
||||||
|
currentFound = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (currentFound) {
|
||||||
|
_ActivateWindow(group->WindowAt(0));
|
||||||
|
if (currentGroup) {
|
||||||
|
Window* window = currentGroup->WindowAt(0)->GetWindow();
|
||||||
|
fDesktop->SendWindowBehind(window);
|
||||||
|
WindowSentBehind(window, NULL);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case kArrowKeyUp:
|
||||||
|
{
|
||||||
|
SATWindow* frontWindow = GetSATWindow(fDesktop->FocusWindow());
|
||||||
|
SATGroup* currentGroup = NULL;
|
||||||
|
if (frontWindow)
|
||||||
|
currentGroup = frontWindow->GetGroup();
|
||||||
|
if (currentGroup && currentGroup->CountItems() <= 1)
|
||||||
|
currentGroup = NULL;
|
||||||
|
|
||||||
|
SATGroup* backmostGroup = NULL;
|
||||||
|
GroupIterator groups(this, fDesktop);
|
||||||
|
while (true) {
|
||||||
|
SATGroup* group = groups.NextGroup();
|
||||||
|
if (group == NULL)
|
||||||
|
break;
|
||||||
|
if (group->CountItems() <= 1)
|
||||||
|
continue;
|
||||||
|
// if no group is selected just activate the first one
|
||||||
|
if (currentGroup == NULL) {
|
||||||
|
_ActivateWindow(group->WindowAt(0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
backmostGroup = group;
|
||||||
|
}
|
||||||
|
if (backmostGroup && backmostGroup != currentGroup) {
|
||||||
|
_ActivateWindow(backmostGroup->WindowAt(0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -369,6 +445,9 @@ StackAndTile::GetDecoratorSettings(Window* window, BMessage& settings)
|
|||||||
SATWindow*
|
SATWindow*
|
||||||
StackAndTile::GetSATWindow(Window* window)
|
StackAndTile::GetSATWindow(Window* window)
|
||||||
{
|
{
|
||||||
|
if (window == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
SATWindowMap::const_iterator it = fSATWindowMap.find(
|
SATWindowMap::const_iterator it = fSATWindowMap.find(
|
||||||
window);
|
window);
|
||||||
if (it != fSATWindowMap.end())
|
if (it != fSATWindowMap.end())
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
virtual void WindowAdded(Window* window);
|
virtual void WindowAdded(Window* window);
|
||||||
virtual void WindowRemoved(Window* window);
|
virtual void WindowRemoved(Window* window);
|
||||||
|
|
||||||
virtual void KeyPressed(uint32 what, int32 key,
|
virtual bool KeyPressed(uint32 what, int32 key,
|
||||||
int32 modifiers);
|
int32 modifiers);
|
||||||
virtual void MouseEvent(BMessage* message) {}
|
virtual void MouseEvent(BMessage* message) {}
|
||||||
virtual void MouseDown(Window* window, BMessage* message,
|
virtual void MouseDown(Window* window, BMessage* message,
|
||||||
|
|||||||
@@ -221,9 +221,7 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
|
|||||||
|| message->what == B_INPUT_METHOD_EVENT)
|
|| message->what == B_INPUT_METHOD_EVENT)
|
||||||
_UpdateFocus(key, modifiers, _target);
|
_UpdateFocus(key, modifiers, _target);
|
||||||
|
|
||||||
fDesktop->KeyEvent(message->what, key, modifiers);
|
return fDesktop->KeyEvent(message->what, key, modifiers);
|
||||||
|
|
||||||
return B_DISPATCH_MESSAGE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -578,7 +576,7 @@ Desktop::BroadcastToAllWindows(int32 code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
filter_result
|
||||||
Desktop::KeyEvent(uint32 what, int32 key, int32 modifiers)
|
Desktop::KeyEvent(uint32 what, int32 key, int32 modifiers)
|
||||||
{
|
{
|
||||||
if (LockAllWindows()) {
|
if (LockAllWindows()) {
|
||||||
@@ -594,7 +592,10 @@ Desktop::KeyEvent(uint32 what, int32 key, int32 modifiers)
|
|||||||
UnlockAllWindows();
|
UnlockAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyKeyPressed(what, key, modifiers);
|
if (NotifyKeyPressed(what, key, modifiers))
|
||||||
|
return B_SKIP_MESSAGE;
|
||||||
|
|
||||||
|
return B_DISPATCH_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
void BroadcastToAllApps(int32 code);
|
void BroadcastToAllApps(int32 code);
|
||||||
void BroadcastToAllWindows(int32 code);
|
void BroadcastToAllWindows(int32 code);
|
||||||
|
|
||||||
void KeyEvent(uint32 what, int32 key,
|
filter_result KeyEvent(uint32 what, int32 key,
|
||||||
int32 modifiers);
|
int32 modifiers);
|
||||||
// Locking
|
// Locking
|
||||||
bool LockSingleWindow()
|
bool LockSingleWindow()
|
||||||
|
|||||||
@@ -91,16 +91,20 @@ DesktopObservable::NotifyWindowRemoved(Window* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
bool
|
||||||
DesktopObservable::NotifyKeyPressed(uint32 what, int32 key, int32 modifiers)
|
DesktopObservable::NotifyKeyPressed(uint32 what, int32 key, int32 modifiers)
|
||||||
{
|
{
|
||||||
if (fWeAreInvoking)
|
if (fWeAreInvoking)
|
||||||
return;
|
return false;
|
||||||
InvokeGuard invokeGuard(fWeAreInvoking);
|
InvokeGuard invokeGuard(fWeAreInvoking);
|
||||||
|
|
||||||
|
bool skipEvent = false;
|
||||||
for (DesktopListener* listener = fDesktopListenerList.First();
|
for (DesktopListener* listener = fDesktopListenerList.First();
|
||||||
listener != NULL; listener = fDesktopListenerList.GetNext(listener))
|
listener != NULL; listener = fDesktopListenerList.GetNext(listener)) {
|
||||||
listener->KeyPressed(what, key, modifiers);
|
if (listener->KeyPressed(what, key, modifiers))
|
||||||
|
skipEvent = true;
|
||||||
|
}
|
||||||
|
return skipEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
virtual void WindowAdded(Window* window) = 0;
|
virtual void WindowAdded(Window* window) = 0;
|
||||||
virtual void WindowRemoved(Window* window) = 0;
|
virtual void WindowRemoved(Window* window) = 0;
|
||||||
|
|
||||||
virtual void KeyPressed(uint32 what, int32 key,
|
virtual bool KeyPressed(uint32 what, int32 key,
|
||||||
int32 modifiers) = 0;
|
int32 modifiers) = 0;
|
||||||
virtual void MouseEvent(BMessage* message) = 0;
|
virtual void MouseEvent(BMessage* message) = 0;
|
||||||
virtual void MouseDown(Window* window, BMessage* message,
|
virtual void MouseDown(Window* window, BMessage* message,
|
||||||
@@ -92,7 +92,7 @@ public:
|
|||||||
void NotifyWindowAdded(Window* window);
|
void NotifyWindowAdded(Window* window);
|
||||||
void NotifyWindowRemoved(Window* window);
|
void NotifyWindowRemoved(Window* window);
|
||||||
|
|
||||||
void NotifyKeyPressed(uint32 what, int32 key,
|
bool NotifyKeyPressed(uint32 what, int32 key,
|
||||||
int32 modifiers);
|
int32 modifiers);
|
||||||
void NotifyMouseEvent(BMessage* message);
|
void NotifyMouseEvent(BMessage* message);
|
||||||
void NotifyMouseDown(Window* window,
|
void NotifyMouseDown(Window* window,
|
||||||
|
|||||||
Reference in New Issue
Block a user