mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-05-07 18:04:15 +00:00
Prevent terminal buttons stealing focus
I have shutdown my computer by accident far too many times now.
This commit is contained in:
parent
47ad7a35dc
commit
0e4b7a5a75
@ -8,6 +8,7 @@ package dan200.computercraft.client.gui;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.client.gui.widgets.ComputerSidebar;
|
||||
import dan200.computercraft.client.gui.widgets.DynamicImageButton;
|
||||
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
|
||||
import dan200.computercraft.shared.computer.core.ClientComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
@ -102,6 +103,16 @@ public abstract class ComputerScreenBase<T extends ContainerComputerBase> extend
|
||||
renderTooltip( stack, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked( double x, double y, int button )
|
||||
{
|
||||
boolean changed = super.mouseClicked( x, y, button );
|
||||
// Clicking the terminate/shutdown button steals focus, which means then pressing "enter" will click the button
|
||||
// again. Restore the focus to the terminal in these cases.
|
||||
if( getFocused() instanceof DynamicImageButton ) setFocused( terminal );
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean mouseDragged( double x, double y, int button, double deltaX, double deltaY )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user