wasd plugin: allow input to world map search when focused

This commit is contained in:
Adam
2018-08-16 19:00:40 -04:00
parent 1117e93be0
commit f7a433f3bc
4 changed files with 20 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ import lombok.Getter;
import lombok.Setter;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.VarClientInt;
import net.runelite.api.VarClientStr;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.widgets.Widget;
@@ -108,7 +109,20 @@ public class WASDCameraPlugin extends Plugin
boolean chatboxFocused()
{
Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT);
return chatboxParent != null && chatboxParent.getOnKeyListener() != null;
if (chatboxParent == null || chatboxParent.getOnKeyListener() == null)
{
return false;
}
// the search box on the world map can be focused, and chat input goes there, even
// though the chatbox still has its key listener.
Widget worldMapSearch = client.getWidget(WidgetInfo.WORLD_MAP_SEARCH);
if (worldMapSearch != null && client.getVar(VarClientInt.WORLD_MAP_SEARCH_FOCUSED) == 1)
{
return false;
}
return true;
}
boolean chatboxDialog()