ClientUI: Add support for changing window opacity.

This commit is contained in:
Aleksander Birkeland
2020-05-31 18:05:48 +02:00
committed by GitHub
parent 7675f92ee5
commit c39cbd6b4f
2 changed files with 27 additions and 4 deletions

View File

@@ -105,11 +105,26 @@ public interface RuneLiteConfig extends Config
return true;
}
@Range(
min = 10,
max = 100
)
@ConfigItem(
keyName = "uiWindowOpacity",
name = "Window opacity",
description = "Set the windows opacity. Requires \"Enable custom window chrome\" to be enabled.",
position = 16
)
default int windowOpacity()
{
return 100;
}
@ConfigItem(
keyName = "gameAlwaysOnTop",
name = "Enable client always on top",
description = "The game will always be on the top of the screen",
position = 16
position = 17
)
default boolean gameAlwaysOnTop()
{
@@ -120,7 +135,7 @@ public interface RuneLiteConfig extends Config
keyName = "warningOnExit",
name = "Display warning on exit",
description = "Toggles a warning popup when trying to exit the client",
position = 17
position = 18
)
default WarningOnExit warningOnExit()
{
@@ -131,7 +146,7 @@ public interface RuneLiteConfig extends Config
keyName = "usernameInTitle",
name = "Show display name in title",
description = "Toggles displaying of local player's display name in client title",
position = 18
position = 19
)
default boolean usernameInTitle()
{

View File

@@ -161,7 +161,7 @@ public class ClientUI
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("runelite") ||
if (!event.getGroup().equals(CONFIG_GROUP) ||
event.getKey().equals(CONFIG_CLIENT_MAXIMIZED) ||
event.getKey().equals(CONFIG_CLIENT_BOUNDS))
{
@@ -979,6 +979,14 @@ public class ClientUI
return;
}
// Update window opacity if the frame is undecorated, translucency capable and not fullscreen
if (frame.isUndecorated() &&
frame.getGraphicsConfiguration().isTranslucencyCapable() &&
frame.getGraphicsConfiguration().getDevice().getFullScreenWindow() == null)
{
frame.setOpacity(((float) config.windowOpacity()) / 100.0f);
}
if (config.usernameInTitle() && (client instanceof Client))
{
final Player player = ((Client)client).getLocalPlayer();