mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-07 06:40:10 +00:00
Keep focus of layer name when right-click a layer > Properties (fix #1466)
This commit is contained in:
parent
9323194cd9
commit
ddff5d559c
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -296,14 +296,19 @@ void Menu::showPopup(const gfx::Point& pos)
|
|||||||
MID(0, pos.y, ui::display_h() - window->bounds().h));
|
MID(0, pos.y, ui::display_h() - window->bounds().h));
|
||||||
|
|
||||||
// Set the focus to the new menubox
|
// Set the focus to the new menubox
|
||||||
Manager::getDefault()->setFocus(menubox);
|
Manager* manager = Manager::getDefault();
|
||||||
|
manager->setFocus(menubox);
|
||||||
menubox->setFocusMagnet(true);
|
menubox->setFocusMagnet(true);
|
||||||
|
|
||||||
// Open the window
|
// Open the window
|
||||||
window->openWindowInForeground();
|
window->openWindowInForeground();
|
||||||
|
|
||||||
// Free the keyboard focus
|
// Free the keyboard focus if it's in the menu popup, in other case
|
||||||
Manager::getDefault()->freeFocus();
|
// it means that the user set the focus to other specific widget
|
||||||
|
// before we closed the popup.
|
||||||
|
Widget* focus = manager->getFocus();
|
||||||
|
if (focus && focus->window() == window)
|
||||||
|
focus->releaseFocus();
|
||||||
|
|
||||||
// Fetch the "menu" so it isn't destroyed
|
// Fetch the "menu" so it isn't destroyed
|
||||||
menubox->setMenu(nullptr);
|
menubox->setMenu(nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user