Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ public boolean mouseClicked(MouseButtonEvent click, boolean doubled) {
mouseX *= s;
mouseY *= s;

// Unfocus all text boxes that are not under the mouse cursor
loopWidgets(root, widget -> {
if (widget instanceof WTextBox textBox && textBox.isFocused() && !textBox.mouseOver) {
textBox.setFocused(false);
}
});

return root.mouseClicked(new MouseButtonEvent(mouseX, mouseY, click.buttonInfo()), doubled);
}

Expand Down Expand Up @@ -337,9 +344,17 @@ public void removed() {
}

if (onClose) {
double restoreX = lastMouseX / mc.getWindow().getGuiScale();
double restoreY = lastMouseY / mc.getWindow().getGuiScale();

taskAfterRender = () -> {
locked = true;
mc.setScreen(parent);

// Restore mouse position to where it was when the screen was closed
if (parent == null) {
glfwSetCursorPos(mc.getWindow().getWindow(), restoreX, restoreY);
}
};
}
}
Expand Down Expand Up @@ -424,4 +439,4 @@ public boolean render(GuiRenderer renderer, double mouseX, double mouseY, double
return super.render(renderer, mouseX, mouseY, delta);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public String getCompletion() {
protected void onCursorChanged() {
cursorVisible = true;
cursorTimer = 0;
animProgress = focused ? 1.0 : 0.0;
}

@Override
Expand Down Expand Up @@ -139,4 +140,4 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub

renderer.scissorEnd();
}
}
}