Fix sidebar hotkey leaking into game client
This commit is contained in:
@@ -37,6 +37,8 @@ import java.awt.GraphicsConfiguration;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
@@ -62,12 +64,14 @@ import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.ExpandResizeType;
|
||||
import net.runelite.client.config.Keybind;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.config.WarningOnExit;
|
||||
import net.runelite.client.events.NavigationButtonAdded;
|
||||
import net.runelite.client.events.NavigationButtonRemoved;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.ui.skin.SubstanceRuneLiteLookAndFeel;
|
||||
import net.runelite.client.util.HotkeyListener;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.OSType;
|
||||
import net.runelite.client.util.OSXUtil;
|
||||
@@ -290,9 +294,17 @@ public class ClientUI
|
||||
frame.add(container);
|
||||
|
||||
// Add key listener
|
||||
final UiKeyListener uiKeyListener = new UiKeyListener(this);
|
||||
frame.addKeyListener(uiKeyListener);
|
||||
keyManager.registerKeyListener(uiKeyListener);
|
||||
final HotkeyListener sidebarListener = new HotkeyListener(() ->
|
||||
new Keybind(KeyEvent.VK_F11, InputEvent.CTRL_DOWN_MASK))
|
||||
{
|
||||
@Override
|
||||
public void hotkeyPressed()
|
||||
{
|
||||
toggleSidebar();
|
||||
}
|
||||
};
|
||||
|
||||
keyManager.registerKeyListener(sidebarListener);
|
||||
|
||||
// Decorate window with custom chrome and titlebar if needed
|
||||
final boolean withTitleBar = config.enableCustomChrome();
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.ui;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
|
||||
class UiKeyListener implements KeyListener
|
||||
{
|
||||
private final ClientUI clientUi;
|
||||
|
||||
UiKeyListener(ClientUI clientUi)
|
||||
{
|
||||
this.clientUi = clientUi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_F11)
|
||||
{
|
||||
SwingUtilities.invokeLater(clientUi::toggleSidebar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user