X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2Fhumaninput%2FKeyboardFocusStack.java;h=02767f1cff515546c415725b99c956cbb341c7e3;hp=4ee7ed8e096aa30d90d57e938e00fe2b9c5f69dd;hb=59baa428fb2d9e7f0fe5423f4cea47f2d6245914;hpb=70ee733b25c56bed539b89ff5507ae0af842d68a diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java index 4ee7ed8..02767f1 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public License @@ -40,16 +40,20 @@ public class KeyboardFocusStack { currentUserInputHandler.focusReceived(viewPanel); } - public void pushFocusOwner(final UserInputHandler newInputHandler) { + public boolean pushFocusOwner(final UserInputHandler newInputHandler) { + boolean updateNeeded = false; + if (currentUserInputHandler == newInputHandler) - return; + return false; if (currentUserInputHandler != null) { - currentUserInputHandler.focusLost(viewPanel); + updateNeeded = currentUserInputHandler.focusLost(viewPanel); inputHandlers.push(currentUserInputHandler); } currentUserInputHandler = newInputHandler; - currentUserInputHandler.focusReceived(viewPanel); + updateNeeded |= currentUserInputHandler.focusReceived(viewPanel); + + return updateNeeded; } }