Restore comments, remove the black spacer bar on platforms where it is not required

This commit is contained in:
downthecrop 2024-10-13 00:04:42 -07:00
parent 413601d0e5
commit de5cbda4f9
2 changed files with 10 additions and 5 deletions

View file

@ -66,7 +66,7 @@ class plugin : Plugin() {
@Exposed(description = "Start minimized/collapsed by default") @Exposed(description = "Start minimized/collapsed by default")
var launchMinimized = false var launchMinimized = false
private const val FIXED_WIDTH = 782 private const val FIXED_WIDTH = 765
private const val NAVBAR_WIDTH = 30 private const val NAVBAR_WIDTH = 30
private const val MAIN_CONTENT_WIDTH = 242 private const val MAIN_CONTENT_WIDTH = 242
private const val WRENCH_ICON = 907 private const val WRENCH_ICON = 907
@ -118,16 +118,19 @@ class plugin : Plugin() {
private fun UpdateDisplaySettings() { private fun UpdateDisplaySettings() {
val mode = GetWindowMode() val mode = GetWindowMode()
val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH
val osName = System.getProperty("os.name").toLowerCase()
val offset = if (osName == "win") 16 else 0
when (mode) { when (mode) {
WindowMode.FIXED -> { WindowMode.FIXED -> {
if (frame.width < FIXED_WIDTH + currentScrollPaneWidth) { if (frame.width < FIXED_WIDTH + currentScrollPaneWidth + offset) {
frame.setSize(FIXED_WIDTH + currentScrollPaneWidth, frame.height) frame.setSize(FIXED_WIDTH + currentScrollPaneWidth + offset, frame.height)
} }
val difference = frame.width - (FIXED_WIDTH + currentScrollPaneWidth)
val difference = frame.width - (FIXED_WIDTH + offset + currentScrollPaneWidth)
GameShell.leftMargin = difference / 2 GameShell.leftMargin = difference / 2
} }
WindowMode.RESIZABLE -> { WindowMode.RESIZABLE -> {
GameShell.canvasWidth = frame.width - (currentScrollPaneWidth + 16) GameShell.canvasWidth = frame.width - (currentScrollPaneWidth + offset)
} }
} }
rightPanelWrapper?.preferredSize = Dimension(currentScrollPaneWidth, frame.height) rightPanelWrapper?.preferredSize = Dimension(currentScrollPaneWidth, frame.height)

View file

@ -57,6 +57,7 @@ class plugin : Plugin() {
} }
fun toggleResizableSd() { fun toggleResizableSd() {
//We only want to toggle resizable SD when we are logged in and the lobby/welcome interface is not open.
if (InterfaceList.aClass13_26 == null || client.gameState != 30) { if (InterfaceList.aClass13_26 == null || client.gameState != 30) {
return return
} }
@ -85,6 +86,7 @@ class plugin : Plugin() {
override fun OnLogout() { override fun OnLogout() {
if (DisplayMode.resizableSD && wantHd) { if (DisplayMode.resizableSD && wantHd) {
//Because resizable SD always uses the "HD" size canvas/window mode (check the in-game Graphics Options with resizeable SD enabled if you don't believe me!), useHD becomes true when logging out, so logging out with resizeSD enabled means "HD" will always be enabled on the login screen after logging out, so we might as well fix the HD flyover by setting resizableSD to false first, and then calling setWindowMode to replace the canvas and set newMode to 2.
DisplayMode.resizableSD = false DisplayMode.resizableSD = false
DisplayMode.setWindowMode(true, 2, GameShell.frameWidth, GameShell.frameHeight) DisplayMode.setWindowMode(true, 2, GameShell.frameWidth, GameShell.frameHeight)
} }