This commit is contained in:
crschnick 2024-04-14 03:34:52 +00:00
parent 6c0b3cb58c
commit f39ec1451b
3 changed files with 22 additions and 3 deletions

View file

@ -28,6 +28,7 @@ import javafx.geometry.Pos;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.input.MouseButton; import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
@ -95,6 +96,16 @@ public abstract class StoreEntryComp extends SimpleComp {
wrapper.executeDefaultAction(); wrapper.executeDefaultAction();
}); });
}); });
button.addEventFilter(MouseEvent.MOUSE_CLICKED, event -> {
if (event.getClickCount() > 1) {
event.consume();
}
});
button.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
if (event.getClickCount() > 1) {
event.consume();
}
});
new ContextMenuAugment<>( new ContextMenuAugment<>(
mouseEvent -> mouseEvent.getButton() == MouseButton.SECONDARY, mouseEvent -> mouseEvent.getButton() == MouseButton.SECONDARY,
null, null,

View file

@ -87,6 +87,8 @@ public class AppTheme {
try { try {
// var c = new WindowControl(stage); // var c = new WindowControl(stage);
// c.setWindowAttribute(20, AppPrefs.get().theme.getValue().isDark()); // c.setWindowAttribute(20, AppPrefs.get().theme.getValue().isDark());
// c.setWindowAttribute(34, 0xFFFFFFFEL);
// c.redraw();
} catch (Throwable e) { } catch (Throwable e) {
ErrorEvent.fromThrowable(e).handle(); ErrorEvent.fromThrowable(e).handle();
} }

View file

@ -40,9 +40,15 @@ public class WindowControl {
} }
public void setWindowAttribute(int attribute, boolean attributeValue) { public void setWindowAttribute(int attribute, boolean attributeValue) {
DwmSupport.INSTANCE.DwmSetWindowAttribute( DwmSupport.INSTANCE.DwmSetWindowAttribute(windowHandle, attribute, new WinDef.BOOLByReference(new WinDef.BOOL(attributeValue)), WinDef.BOOL.SIZE);
windowHandle, attribute, new WinDef.BOOLByReference(new WinDef.BOOL(attributeValue)), WinDef.BOOL.SIZE); }
User32.INSTANCE.UpdateWindow(windowHandle);
public void setWindowAttribute(int attribute, long attributeValue) {
DwmSupport.INSTANCE.DwmSetWindowAttribute(windowHandle, attribute, new WinDef.DWORDByReference(new WinDef.DWORD(attributeValue)), WinDef.DWORD.SIZE);
}
public void redraw() {
User32.INSTANCE.RedrawWindow(windowHandle, null, null, new WinDef.DWORD(User32.RDW_FRAME | User32.RDW_VALIDATE));
} }
public interface DwmSupport extends Library { public interface DwmSupport extends Library {