Skip to content

Commit

Permalink
Initial commit updating search focus behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
comploplo authored Oct 30, 2023
1 parent e460464 commit 709827f
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,22 @@ private boolean canSyncFromJEINow() {

@Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
boolean wasFocused = isFocused();

boolean result = super.mouseClicked(mouseX, mouseY, mouseButton);

boolean clickedWidget = mouseX >= this.getX() && mouseX < this.getX() + this.width && mouseY >= this.getY() && mouseY < this.getY() + this.height;

if (clickedWidget && mouseButton == 1) {
// On right click, clear the widget and focus, save history if necessary.
if (isFocused()) {
saveHistory()
}
setValue("");
setFocused(true);
} else if (wasFocused != isFocused()) {
}

if (!clickedWidget && isFocused()) {
// If we are focused, and we click outside the search box, lose focus.
saveHistory();
setFocused(false);
}

return result;
Expand Down

0 comments on commit 709827f

Please sign in to comment.