* The app_server now gives top-most menus the keyboard focus.
* BMenuWindow now makes its menu focus view, so that it can receive key events. * Keyboard navigation doesn't work as it should though, that is bug #670 is still valid - there should even be another recently opened bug about this, but Trac obviously ate it :-/ git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19152 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -55,6 +55,7 @@ BMenuWindow::AttachMenu(BMenu *menu)
|
|||||||
if (menu != NULL) {
|
if (menu != NULL) {
|
||||||
BMenuFrame *menuFrame = new BMenuFrame(menu);
|
BMenuFrame *menuFrame = new BMenuFrame(menu);
|
||||||
AddChild(menuFrame);
|
AddChild(menuFrame);
|
||||||
|
menu->MakeFocus(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,12 +100,9 @@ KeyboardFilter::_UpdateFocus(int32 key, EventTarget** _target)
|
|||||||
if (!fDesktop->LockSingleWindow())
|
if (!fDesktop->LockSingleWindow())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
EventTarget* focus = fDesktop->KeyboardEventTarget();
|
||||||
bigtime_t now = system_time();
|
bigtime_t now = system_time();
|
||||||
|
|
||||||
EventTarget* focus = NULL;
|
|
||||||
if (fDesktop->FocusWindow() != NULL)
|
|
||||||
focus = &fDesktop->FocusWindow()->EventTarget();
|
|
||||||
|
|
||||||
// TODO: this is a try to not steal focus from the current window
|
// TODO: this is a try to not steal focus from the current window
|
||||||
// in case you enter some text and a window pops up you haven't
|
// in case you enter some text and a window pops up you haven't
|
||||||
// triggered yourself (like a pop-up window in your browser while
|
// triggered yourself (like a pop-up window in your browser while
|
||||||
@@ -1074,6 +1071,25 @@ Desktop::_UpdateFronts(bool updateFloating)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the current keyboard event target candidate - which is either the
|
||||||
|
top-most window (in case it's a menu), or the one having focus.
|
||||||
|
The window lock must be held when calling this function.
|
||||||
|
*/
|
||||||
|
EventTarget*
|
||||||
|
Desktop::KeyboardEventTarget()
|
||||||
|
{
|
||||||
|
WindowLayer* window = _CurrentWindows().LastWindow();
|
||||||
|
if (window != NULL && window->Feel() == kMenuWindowFeel)
|
||||||
|
return &window->EventTarget();
|
||||||
|
|
||||||
|
if (FocusWindow() != NULL)
|
||||||
|
return &FocusWindow()->EventTarget();
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Desktop::_WindowHasModal(WindowLayer* window)
|
Desktop::_WindowHasModal(WindowLayer* window)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
int32 ViewUnderMouse(const WindowLayer* window);
|
int32 ViewUnderMouse(const WindowLayer* window);
|
||||||
|
|
||||||
void SetFocusWindow(WindowLayer* window);
|
void SetFocusWindow(WindowLayer* window);
|
||||||
|
EventTarget* KeyboardEventTarget();
|
||||||
|
|
||||||
WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID);
|
WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID);
|
||||||
//WindowLayer* FindWindowLayerByServerToken(int32 token);
|
//WindowLayer* FindWindowLayerByServerToken(int32 token);
|
||||||
|
|||||||
Reference in New Issue
Block a user