From 6028711e263b94c8209c0511b8c9136f924479c6 Mon Sep 17 00:00:00 2001 From: Mark Raynsford Date: Fri, 8 Dec 2023 11:18:55 +0000 Subject: [PATCH] Separate event types Separate events into input and output types. Affects: https://github.com/io7m/jsycamore/issues/46 --- .../api/events/SyEventInputType.java | 33 ++++++++++++++++ .../api/events/SyEventOutputType.java | 33 ++++++++++++++++ .../api/events/SyEventReceiverType.java | 2 +- .../jsycamore/api/events/SyEventType.java | 11 +----- .../api/keyboard/SyKeyEventType.java | 4 +- .../jsycamore/api/menus/SyMenuEventType.java | 4 +- .../jsycamore/api/mouse/SyMouseEventType.java | 5 ++- .../api/windows/SyWindowEventType.java | 4 +- .../standard/SyComponentAbstract.java | 8 ++-- .../components/standard/SyImageView.java | 6 +-- .../components/standard/SyLayoutAbstract.java | 6 +-- .../jsycamore/components/standard/SyMenu.java | 6 +-- .../components/standard/SyMenuBar.java | 21 ++++++---- .../components/standard/SySpace.java | 6 +-- .../components/standard/buttons/SyButton.java | 4 +- .../standard/buttons/SyButtonAbstract.java | 8 ++-- .../standard/internal/SyMenuItemAtom.java | 16 +++----- .../internal/SyMenuItemSeparator.java | 6 +-- .../standard/internal/SyMenuItemSubmenu.java | 38 ++++++++++++++----- .../internal/scrollbars/SyScrollBarH.java | 6 +-- .../scrollbars/SyScrollBarHButtonLeft.java | 4 +- .../scrollbars/SyScrollBarHButtonRight.java | 4 +- .../scrollbars/SyScrollBarHButtonThumb.java | 9 +++-- .../scrollbars/SyScrollBarHTrack.java | 6 +-- .../internal/scrollbars/SyScrollBarV.java | 6 +-- .../scrollbars/SyScrollBarVButtonDown.java | 4 +- .../scrollbars/SyScrollBarVButtonThumb.java | 9 +++-- .../scrollbars/SyScrollBarVButtonUp.java | 4 +- .../scrollbars/SyScrollBarVTrack.java | 6 +-- .../internal/scrollpanes/SyScrollPane.java | 6 +-- .../scrollpanes/SyScrollPaneContentArea.java | 6 +-- .../SyScrollPaneContentAreaViewport.java | 6 +-- .../components/standard/text/SyTextArea.java | 6 +-- .../standard/text/SyTextMultiLineView.java | 10 ++--- .../components/standard/text/SyTextView.java | 10 ++--- .../java/com/io7m/jsycamore/tests/SyBlob.java | 5 ++- .../io7m/jsycamore/tests/SyButtonTest.java | 14 ------- .../io7m/jsycamore/tests/SyFormRowTest.java | 14 ------- .../com/io7m/jsycamore/tests/SyFormTest.java | 14 ------- .../io7m/jsycamore/tests/SyImageViewTest.java | 14 ------- .../tests/SyLayoutHorizontalTest.java | 14 ------- .../jsycamore/tests/SyLayoutManualTest.java | 14 ------- .../jsycamore/tests/SyLayoutMarginTest.java | 14 ------- .../jsycamore/tests/SyLayoutVerticalTest.java | 14 ------- .../io7m/jsycamore/tests/SyMenuBarTest.java | 14 ------- .../com/io7m/jsycamore/tests/SyMenuTest.java | 14 ------- .../jsycamore/tests/SyPackHorizontalTest.java | 14 ------- .../jsycamore/tests/SyPackVerticalTest.java | 14 ------- .../io7m/jsycamore/tests/SyScreenTest.java | 28 -------------- .../com/io7m/jsycamore/tests/SySpaceTest.java | 14 ------- .../io7m/jsycamore/tests/SyTextAreaTest.java | 14 ------- .../tests/SyTextMultiLineViewTest.java | 8 ---- .../io7m/jsycamore/tests/SyTextViewTest.java | 8 ---- .../internal/SyWindowButtonComponent.java | 17 +++++---- .../vanilla/internal/SyWindowContentArea.java | 6 +-- .../vanilla/internal/SyWindowResizeE.java | 17 +++++---- .../vanilla/internal/SyWindowResizeN.java | 17 +++++---- .../vanilla/internal/SyWindowResizeNE.java | 17 +++++---- .../vanilla/internal/SyWindowResizeNW.java | 17 +++++---- .../vanilla/internal/SyWindowResizeS.java | 17 +++++---- .../vanilla/internal/SyWindowResizeSE.java | 17 +++++---- .../vanilla/internal/SyWindowResizeSW.java | 17 +++++---- .../vanilla/internal/SyWindowResizeW.java | 17 +++++---- .../vanilla/internal/SyWindowRoot.java | 6 +-- .../vanilla/internal/SyWindowTitle.java | 18 +++++---- 65 files changed, 308 insertions(+), 443 deletions(-) create mode 100644 com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventInputType.java create mode 100644 com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventOutputType.java diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventInputType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventInputType.java new file mode 100644 index 00000000..968a5d4e --- /dev/null +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventInputType.java @@ -0,0 +1,33 @@ +/* + * Copyright © 2023 Mark Raynsford https://www.io7m.com + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +package com.io7m.jsycamore.api.events; + +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; +import com.io7m.jsycamore.api.mouse.SyMouseEventType; + +/** + * The type of events that the system accepts as input. + */ + +public sealed interface SyEventInputType + extends SyEventType + permits SyKeyEventType, + SyMouseEventType +{ + +} diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventOutputType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventOutputType.java new file mode 100644 index 00000000..492abb31 --- /dev/null +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventOutputType.java @@ -0,0 +1,33 @@ +/* + * Copyright © 2023 Mark Raynsford https://www.io7m.com + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +package com.io7m.jsycamore.api.events; + +import com.io7m.jsycamore.api.menus.SyMenuEventType; +import com.io7m.jsycamore.api.windows.SyWindowEventType; + +/** + * The type of events that the system produces as output. + */ + +public sealed interface SyEventOutputType + extends SyEventType + permits SyMenuEventType, + SyWindowEventType +{ + +} diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventReceiverType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventReceiverType.java index 0ad5da20..fc512a68 100644 --- a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventReceiverType.java +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventReceiverType.java @@ -30,5 +30,5 @@ public interface SyEventReceiverType * @return A value indicating if the event was understood and consumed */ - SyEventConsumed eventSend(SyEventType event); + SyEventConsumed eventSend(SyEventInputType event); } diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java index 5b859afd..832110bf 100644 --- a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java @@ -16,20 +16,13 @@ package com.io7m.jsycamore.api.events; -import com.io7m.jsycamore.api.keyboard.SyKeyEventType; -import com.io7m.jsycamore.api.menus.SyMenuEventType; -import com.io7m.jsycamore.api.mouse.SyMouseEventType; -import com.io7m.jsycamore.api.windows.SyWindowEventType; - /** * The base type of events used by the UI. */ public sealed interface SyEventType - permits SyKeyEventType, - SyMenuEventType, - SyMouseEventType, - SyWindowEventType + permits SyEventInputType, + SyEventOutputType { } diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/keyboard/SyKeyEventType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/keyboard/SyKeyEventType.java index fa721076..81a7d6c2 100644 --- a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/keyboard/SyKeyEventType.java +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/keyboard/SyKeyEventType.java @@ -17,14 +17,14 @@ package com.io7m.jsycamore.api.keyboard; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; /** * The type of key events. */ public sealed interface SyKeyEventType - extends SyEventType + extends SyEventInputType permits SyKeyEventModifierPressed, SyKeyEventModifierReleased, SyKeyEventPressed, diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/menus/SyMenuEventType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/menus/SyMenuEventType.java index 8a4e12f4..009f4fa8 100644 --- a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/menus/SyMenuEventType.java +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/menus/SyMenuEventType.java @@ -17,14 +17,14 @@ package com.io7m.jsycamore.api.menus; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventOutputType; /** * The type of events relating to menus. */ public sealed interface SyMenuEventType - extends SyEventType + extends SyEventOutputType permits SyMenuClosed, SyMenuOpened { diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/mouse/SyMouseEventType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/mouse/SyMouseEventType.java index f50a2fd3..43350bf7 100644 --- a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/mouse/SyMouseEventType.java +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/mouse/SyMouseEventType.java @@ -16,13 +16,14 @@ package com.io7m.jsycamore.api.mouse; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; /** * The base type of mouse events. */ -public sealed interface SyMouseEventType extends SyEventType +public sealed interface SyMouseEventType + extends SyEventInputType permits SyMouseEventOnHeld, SyMouseEventOnNoLongerOver, SyMouseEventOnOver, diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/windows/SyWindowEventType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/windows/SyWindowEventType.java index c7720310..7def9e5b 100644 --- a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/windows/SyWindowEventType.java +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/windows/SyWindowEventType.java @@ -16,14 +16,14 @@ package com.io7m.jsycamore.api.windows; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventOutputType; /** * The type of events relating to windows. */ public sealed interface SyWindowEventType - extends SyEventType + extends SyEventOutputType permits SyWindowBecameInvisible, SyWindowBecameVisible, SyWindowClosed, diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyComponentAbstract.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyComponentAbstract.java index 3a9a9a96..4fae72e7 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyComponentAbstract.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyComponentAbstract.java @@ -27,7 +27,7 @@ import com.io7m.jsycamore.api.components.SyComponentReadableType; import com.io7m.jsycamore.api.components.SyComponentType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnNoLongerOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnOver; import com.io7m.jsycamore.api.screens.SyScreenType; @@ -253,7 +253,7 @@ public final Optional windowReadable() @Override public final SyEventConsumed eventSend( - final SyEventType event) + final SyEventInputType event) { /* * Only deliver the event to this component if it is active. @@ -261,7 +261,7 @@ public final SyEventConsumed eventSend( SyEventConsumed consumed = EVENT_CONSUMED; if (this.isActive()) { - consumed = this.onEvent(event); + consumed = this.onEventInput(event); } /* @@ -301,7 +301,7 @@ public final SyEventConsumed eventSend( * @return {@code true} if the event has been consumed */ - protected abstract SyEventConsumed onEvent(SyEventType event); + protected abstract SyEventConsumed onEventInput(SyEventInputType event); @Override public final Optional componentForWindowRelative( diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyImageView.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyImageView.java index 6439e319..5d465ab4 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyImageView.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyImageView.java @@ -20,7 +20,7 @@ import com.io7m.jattribute.core.AttributeType; import com.io7m.jsycamore.api.components.SyImageViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; @@ -68,8 +68,8 @@ public SyImageView(final SyScreenType inScreen) } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyLayoutAbstract.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyLayoutAbstract.java index 9d2a7218..0c14380d 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyLayoutAbstract.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyLayoutAbstract.java @@ -18,7 +18,7 @@ import com.io7m.jsycamore.api.components.SyContainerType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; @@ -43,8 +43,8 @@ protected SyLayoutAbstract( } @Override - protected final SyEventConsumed onEvent( - final SyEventType event) + protected final SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenu.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenu.java index 7a297c1c..c896b196 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenu.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenu.java @@ -24,7 +24,7 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.menus.SyMenuItemAtomType; import com.io7m.jsycamore.api.menus.SyMenuItemSeparatorType; @@ -234,8 +234,8 @@ public List items() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenuBar.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenuBar.java index 95f56f1f..9fe36cb6 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenuBar.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SyMenuBar.java @@ -23,14 +23,18 @@ import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.components.SyTextViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.menus.SyMenuBarItemType; import com.io7m.jsycamore.api.menus.SyMenuBarType; import com.io7m.jsycamore.api.menus.SyMenuSelected; import com.io7m.jsycamore.api.menus.SyMenuType; +import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; +import com.io7m.jsycamore.api.mouse.SyMouseEventOnNoLongerOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; +import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; import com.io7m.jsycamore.api.spaces.SySpaceViewportType; @@ -99,8 +103,8 @@ public SyMenuBar(final SyScreenType inScreen) } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } @@ -247,8 +251,8 @@ public PAreaSizeI layout( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return switch (event) { case final SyMouseEventOnPressed e -> { @@ -264,9 +268,10 @@ protected SyEventConsumed onEvent( } yield EVENT_NOT_CONSUMED; } - default -> { - yield EVENT_NOT_CONSUMED; - } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + case final SyMouseEventOnHeld e -> EVENT_NOT_CONSUMED; + case final SyMouseEventOnNoLongerOver e -> EVENT_NOT_CONSUMED; + case final SyMouseEventOnReleased e -> EVENT_NOT_CONSUMED; }; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SySpace.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SySpace.java index b0a45b83..b9d62f54 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SySpace.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/SySpace.java @@ -18,7 +18,7 @@ package com.io7m.jsycamore.components.standard; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; @@ -67,8 +67,8 @@ public List themeClassesDefaultForComponent() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButton.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButton.java index e90eac7c..6050c8a8 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButton.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButton.java @@ -20,7 +20,7 @@ import com.io7m.jsycamore.api.components.SyButtonWithTextType; import com.io7m.jsycamore.api.components.SyTextViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.text.SyText; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; @@ -224,7 +224,7 @@ public static SyButtonBuilderType buttonBuilder( @Override protected SyEventConsumed onOtherEvent( - final SyEventType event) + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButtonAbstract.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButtonAbstract.java index cff8db92..03b7973b 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButtonAbstract.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/buttons/SyButtonAbstract.java @@ -18,7 +18,7 @@ import com.io7m.jsycamore.api.components.SyButtonType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -72,8 +72,8 @@ public final void setOnClickListener( } @Override - protected final SyEventConsumed onEvent( - final SyEventType event) + protected final SyEventConsumed onEventInput( + final SyEventInputType event) { if (event instanceof final SyMouseEventType mouseEvent) { return this.onMouseEvent(mouseEvent); @@ -96,7 +96,7 @@ public final boolean isPressed() * @return {@code true} if the event has been consumed */ - protected abstract SyEventConsumed onOtherEvent(SyEventType event); + protected abstract SyEventConsumed onOtherEvent(SyEventInputType event); private SyEventConsumed onMouseEvent( final SyMouseEventType event) diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemAtom.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemAtom.java index 5a8fbc2a..69e9e658 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemAtom.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemAtom.java @@ -21,16 +21,13 @@ import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.components.SyTextViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.menus.SyMenuItemAtomType; -import com.io7m.jsycamore.api.menus.SyMenuServiceType; import com.io7m.jsycamore.api.menus.SyMenuType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; -import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; import com.io7m.jsycamore.api.text.SyText; -import com.io7m.jsycamore.api.windows.SyWindowType; import com.io7m.jsycamore.components.standard.SyAlign; import com.io7m.jsycamore.components.standard.SyComponentAbstract; import com.io7m.jsycamore.components.standard.SyImageView; @@ -178,8 +175,8 @@ public boolean isMouseOverMenuDescendant() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { if (event instanceof final SyMouseEventOnReleased released) { return switch (released.button()) { @@ -189,10 +186,9 @@ protected SyEventConsumed onEvent( try { this.action.run(); } finally { - this.window() - .map(SyWindowType::screen) - .map(SyScreenType::menuService) - .ifPresent(SyMenuServiceType::menuClose); + this.screen() + .menuService() + .menuClose(); } yield EVENT_CONSUMED; diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSeparator.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSeparator.java index 1f8041e8..086b59b1 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSeparator.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSeparator.java @@ -19,7 +19,7 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.menus.SyMenuItemSeparatorType; import com.io7m.jsycamore.api.menus.SyMenuType; @@ -67,8 +67,8 @@ public PAreaSizeI layout( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSubmenu.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSubmenu.java index 857f0728..8dfe378c 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSubmenu.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/SyMenuItemSubmenu.java @@ -22,12 +22,17 @@ import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.components.SyTextViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.menus.SyMenuItemSubmenuType; import com.io7m.jsycamore.api.menus.SyMenuItemType; import com.io7m.jsycamore.api.menus.SyMenuType; +import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; +import com.io7m.jsycamore.api.mouse.SyMouseEventOnNoLongerOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnOver; +import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; +import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; import com.io7m.jsycamore.api.spaces.SySpaceViewportType; @@ -214,15 +219,30 @@ public AttributeType text() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof SyMouseEventOnOver) { - this.openMenu(); - return EVENT_CONSUMED; - } - - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventOnOver e -> { + this.openMenu(); + yield EVENT_CONSUMED; + } + case final SyKeyEventType e -> { + yield EVENT_NOT_CONSUMED; + } + case final SyMouseEventOnHeld e -> { + yield EVENT_NOT_CONSUMED; + } + case final SyMouseEventOnNoLongerOver e -> { + yield EVENT_NOT_CONSUMED; + } + case final SyMouseEventOnPressed e -> { + yield EVENT_NOT_CONSUMED; + } + case final SyMouseEventOnReleased e -> { + yield EVENT_NOT_CONSUMED; + } + }; } private void openMenu() diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarH.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarH.java index de00dc99..64d0ced6 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarH.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarH.java @@ -26,7 +26,7 @@ import com.io7m.jsycamore.api.components.SyScrollBarHideIfDisabled; import com.io7m.jsycamore.api.components.SyScrollBarHorizontalType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; @@ -224,8 +224,8 @@ public PAreaSizeI layout( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonLeft.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonLeft.java index 940fd1a2..b1831137 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonLeft.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonLeft.java @@ -17,7 +17,7 @@ package com.io7m.jsycamore.components.standard.internal.scrollbars; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; import com.io7m.jsycamore.components.standard.SyAlign; @@ -60,7 +60,7 @@ final class SyScrollBarHButtonLeft extends SyButtonAbstract @Override protected SyEventConsumed onOtherEvent( - final SyEventType event) + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonRight.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonRight.java index 4888a997..2d87ec8e 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonRight.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonRight.java @@ -17,7 +17,7 @@ package com.io7m.jsycamore.components.standard.internal.scrollbars; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; import com.io7m.jsycamore.components.standard.SyAlign; @@ -60,7 +60,7 @@ final class SyScrollBarHButtonRight extends SyButtonAbstract @Override protected SyEventConsumed onOtherEvent( - final SyEventType event) + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonThumb.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonThumb.java index b3aefbbb..95917d14 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonThumb.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHButtonThumb.java @@ -20,7 +20,8 @@ import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.components.SyScrollBarDrag; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnNoLongerOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnOver; @@ -117,14 +118,14 @@ public boolean isPressed() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return switch (event) { case final SyMouseEventType e -> { yield this.onMouseEvent(e); } - default -> EVENT_NOT_CONSUMED; + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; }; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHTrack.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHTrack.java index 2d103f65..f34505c2 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHTrack.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarHTrack.java @@ -23,7 +23,7 @@ import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.components.SyScrollBarDrag; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; @@ -135,8 +135,8 @@ void setScrollAmountShown( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarV.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarV.java index 04bb5c30..058b2526 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarV.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarV.java @@ -26,7 +26,7 @@ import com.io7m.jsycamore.api.components.SyScrollBarHideIfDisabled; import com.io7m.jsycamore.api.components.SyScrollBarVerticalType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; @@ -224,8 +224,8 @@ public PAreaSizeI layout( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonDown.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonDown.java index c26886df..c8c5c9be 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonDown.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonDown.java @@ -17,7 +17,7 @@ package com.io7m.jsycamore.components.standard.internal.scrollbars; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; import com.io7m.jsycamore.components.standard.SyAlign; @@ -60,7 +60,7 @@ final class SyScrollBarVButtonDown extends SyButtonAbstract @Override protected SyEventConsumed onOtherEvent( - final SyEventType event) + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonThumb.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonThumb.java index be9c8e99..e145b569 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonThumb.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonThumb.java @@ -20,7 +20,8 @@ import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.components.SyScrollBarDrag; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnNoLongerOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnOver; @@ -117,14 +118,14 @@ public boolean isPressed() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return switch (event) { case final SyMouseEventType e -> { yield this.onMouseEvent(e); } - default -> EVENT_NOT_CONSUMED; + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; }; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonUp.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonUp.java index f60dacf3..e1e99806 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonUp.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVButtonUp.java @@ -17,7 +17,7 @@ package com.io7m.jsycamore.components.standard.internal.scrollbars; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; import com.io7m.jsycamore.components.standard.SyAlign; @@ -60,7 +60,7 @@ final class SyScrollBarVButtonUp extends SyButtonAbstract @Override protected SyEventConsumed onOtherEvent( - final SyEventType event) + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVTrack.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVTrack.java index 32e49343..8b556f95 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVTrack.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollbars/SyScrollBarVTrack.java @@ -23,7 +23,7 @@ import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.components.SyScrollBarDrag; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; @@ -136,8 +136,8 @@ void setScrollAmountShown( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPane.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPane.java index 760cbdeb..77e205a3 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPane.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPane.java @@ -26,7 +26,7 @@ import com.io7m.jsycamore.api.components.SyScrollBarVerticalType; import com.io7m.jsycamore.api.components.SyScrollPaneType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; @@ -260,8 +260,8 @@ public PAreaSizeI layout( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentArea.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentArea.java index af7046a7..0ba4b901 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentArea.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentArea.java @@ -18,7 +18,7 @@ package com.io7m.jsycamore.components.standard.internal.scrollpanes; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; import com.io7m.jsycamore.components.standard.SyComponentAbstract; @@ -43,8 +43,8 @@ public List themeClassesDefaultForComponent() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentAreaViewport.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentAreaViewport.java index 1ae75912..eddf1b4f 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentAreaViewport.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/internal/scrollpanes/SyScrollPaneContentAreaViewport.java @@ -18,7 +18,7 @@ package com.io7m.jsycamore.components.standard.internal.scrollpanes; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; import com.io7m.jsycamore.components.standard.SyComponentAbstract; @@ -43,8 +43,8 @@ public List themeClassesDefaultForComponent() } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextArea.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextArea.java index 27c27564..fc9eac03 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextArea.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextArea.java @@ -26,7 +26,7 @@ import com.io7m.jsycamore.api.components.SyScrollPaneType; import com.io7m.jsycamore.api.components.SyTextAreaType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; @@ -89,8 +89,8 @@ public SyTextArea( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextMultiLineView.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextMultiLineView.java index 54a205bd..1660a006 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextMultiLineView.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextMultiLineView.java @@ -22,10 +22,9 @@ import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.components.SyTextMultiLineViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; -import com.io7m.jsycamore.api.menus.SyMenuEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnNoLongerOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnOver; @@ -38,7 +37,6 @@ import com.io7m.jsycamore.api.text.SyTextLineMeasuredType; import com.io7m.jsycamore.api.text.SyTextMultiLineModelType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; -import com.io7m.jsycamore.api.windows.SyWindowEventType; import com.io7m.jsycamore.components.standard.SyComponentAttributes; import java.util.Collections; @@ -95,14 +93,12 @@ public SyTextMultiLineView( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return switch (event) { case final SyMouseEventType e -> this.onMouseEvent(e); case final SyKeyEventType e -> EVENT_NOT_CONSUMED; - case final SyMenuEventType e -> EVENT_NOT_CONSUMED; - case final SyWindowEventType e -> EVENT_NOT_CONSUMED; }; } diff --git a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextView.java b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextView.java index ef2e8f51..dd2f7a6d 100644 --- a/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextView.java +++ b/com.io7m.jsycamore.components.standard/src/main/java/com/io7m/jsycamore/components/standard/text/SyTextView.java @@ -21,10 +21,9 @@ import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.components.SyTextViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; -import com.io7m.jsycamore.api.menus.SyMenuEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnNoLongerOver; import com.io7m.jsycamore.api.mouse.SyMouseEventOnOver; @@ -37,7 +36,6 @@ import com.io7m.jsycamore.api.text.SyText; import com.io7m.jsycamore.api.text.SyTextSingleLineModelType; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; -import com.io7m.jsycamore.api.windows.SyWindowEventType; import com.io7m.jsycamore.components.standard.SyComponentAbstract; import com.io7m.jsycamore.components.standard.SyComponentAttributes; @@ -142,14 +140,12 @@ public static SyTextViewType textView( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return switch (event) { case final SyMouseEventType e -> this.onMouseEvent(e); case final SyKeyEventType e -> EVENT_NOT_CONSUMED; - case final SyMenuEventType e -> EVENT_NOT_CONSUMED; - case final SyWindowEventType e -> EVENT_NOT_CONSUMED; }; } diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyBlob.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyBlob.java index 292c0da0..f4a0d8f9 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyBlob.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyBlob.java @@ -20,6 +20,7 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.events.SyEventConsumed; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.events.SyEventType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; @@ -102,8 +103,8 @@ public PAreaSizeI layout( } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyButtonTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyButtonTest.java index 112fd5df..8b4739fe 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyButtonTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyButtonTest.java @@ -271,20 +271,6 @@ public void testButtonTextInitialExtras() assertEquals("Q", c.themeClassesInPreferenceOrder().get(0).className()); } - /** - * A button doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyButtonWithTextType newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormRowTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormRowTest.java index db80049f..c09e6465 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormRowTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormRowTest.java @@ -225,20 +225,6 @@ public void testLayoutAllFlexible() assertEquals(48, c2.size().get().sizeY()); } - /** - * A layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyFormRow newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormTest.java index e0072462..7146e820 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyFormTest.java @@ -38,20 +38,6 @@ public void formSetup() } - /** - * A layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyForm newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyImageViewTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyImageViewTest.java index 71dedd23..f8d6f9f2 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyImageViewTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyImageViewTest.java @@ -36,20 +36,6 @@ public void imageViewSetup() } - /** - * An image view doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyImageView newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutHorizontalTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutHorizontalTest.java index c4bf0c3f..eb792bd8 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutHorizontalTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutHorizontalTest.java @@ -108,20 +108,6 @@ public void testSimpleLayoutPadded() assertEquals(300, b2.size().get().sizeY()); } - /** - * A horizontal layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyLayoutHorizontal newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutManualTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutManualTest.java index 7ca13069..3d898b23 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutManualTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutManualTest.java @@ -81,20 +81,6 @@ public void testSimpleLayout() assertEquals(20, b2.size().get().sizeY()); } - /** - * A layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyLayoutManual newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutMarginTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutMarginTest.java index 0dea827f..aa4d6b36 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutMarginTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutMarginTest.java @@ -109,20 +109,6 @@ public void testMarginTooLarge() assertEquals(0, b.size().get().sizeY()); } - /** - * A layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyLayoutMargin newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutVerticalTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutVerticalTest.java index bd6f8a79..12fa49a5 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutVerticalTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyLayoutVerticalTest.java @@ -108,20 +108,6 @@ public void testSimpleLayoutPadded() assertEquals(95, b2.size().get().sizeY()); } - /** - * A vertical layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyLayoutVertical newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuBarTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuBarTest.java index a8d102a7..bf174c3a 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuBarTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuBarTest.java @@ -62,20 +62,6 @@ public void testMenuAcyclic() }); } - /** - * A menu doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyMenuBar newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuTest.java index c09ff415..1b12b516 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyMenuTest.java @@ -121,20 +121,6 @@ public void testMenuAcyclic() }); } - /** - * A menu doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyMenu newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackHorizontalTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackHorizontalTest.java index 47a0004e..700cec49 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackHorizontalTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackHorizontalTest.java @@ -245,20 +245,6 @@ public void testFillSpace() assertEquals(300, c.size().get().sizeY()); } - /** - * A horizontal layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyPackHorizontal newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackVerticalTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackVerticalTest.java index 864df604..77d717c9 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackVerticalTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyPackVerticalTest.java @@ -245,20 +245,6 @@ public void testFillSpace() assertEquals(300, c.size().get().sizeX()); } - /** - * A vertical layout doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyPackVertical newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyScreenTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyScreenTest.java index 3eda77fc..4c6cd3f6 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyScreenTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyScreenTest.java @@ -1158,34 +1158,6 @@ public void testWindowResizeButtonsNotLeft() assertEquals(0, this.events.size()); } - /** - * The window components ignore window events. - * - * @throws Exception On errors - */ - - @Test - public void testWindowComponentsIgnoreWindowEvents() - throws Exception - { - final var w0 = - this.windowService.windowCreate(256, 256); - - var root = w0.contentArea().node(); - while (root.parent().isPresent()) { - root = root.parent().get(); - } - - final var finalRoot = root; - root.forEachDepthFirst(Void.class, (input, depth, node) -> { - final var component = - finalRoot.value(); - final var result = - component.eventSend(new SyWindowClosed(w0.id())); - assertEquals(EVENT_NOT_CONSUMED, result); - }); - } - /** * Mouse move events outside an open window are not consumed. * diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SySpaceTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SySpaceTest.java index 4b3be445..2a9cd719 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SySpaceTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SySpaceTest.java @@ -35,20 +35,6 @@ public void spaceSetup() } - /** - * A space doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SySpace newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextAreaTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextAreaTest.java index 23226ebb..db770c4b 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextAreaTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextAreaTest.java @@ -37,20 +37,6 @@ public void textViewSetup() } - /** - * A text area doesn't accept window events. - */ - - @Test - public void testWindowEvents() - { - final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); - } - @Override protected SyTextArea newComponent() { diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextMultiLineViewTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextMultiLineViewTest.java index 5272bc48..772a9c49 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextMultiLineViewTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextMultiLineViewTest.java @@ -135,10 +135,6 @@ public void textViewSetup( public void testIgnoredEvents() { final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); assertEquals( EVENT_NOT_CONSUMED, c.eventSend(new SyMouseEventOnOver(PVectors2I.zero(), c)) @@ -151,10 +147,6 @@ public void testIgnoredEvents() EVENT_NOT_CONSUMED, c.eventSend(new SyKeyEventPressed(SyKeyCode.SY_KEY_E)) ); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyMenuClosed(Mockito.mock(SyMenuType.class))) - ); } /** diff --git a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextViewTest.java b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextViewTest.java index b646ac60..4c95fdc9 100644 --- a/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextViewTest.java +++ b/com.io7m.jsycamore.tests/src/main/java/com/io7m/jsycamore/tests/SyTextViewTest.java @@ -70,10 +70,6 @@ public void textViewSetup() public void testIgnoredEvents() { final var c = this.newComponent(); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyWindowClosed(new SyWindowID(UUID.randomUUID()))) - ); assertEquals( EVENT_NOT_CONSUMED, c.eventSend(new SyMouseEventOnOver(PVectors2I.zero(), c)) @@ -86,10 +82,6 @@ public void testIgnoredEvents() EVENT_NOT_CONSUMED, c.eventSend(new SyKeyEventPressed(SyKeyCode.SY_KEY_E)) ); - assertEquals( - EVENT_NOT_CONSUMED, - c.eventSend(new SyMenuClosed(Mockito.mock(SyMenuType.class))) - ); } /** diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowButtonComponent.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowButtonComponent.java index 4dece37a..b91c2deb 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowButtonComponent.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowButtonComponent.java @@ -18,7 +18,8 @@ import com.io7m.jsycamore.api.components.SyButtonType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -62,13 +63,15 @@ public final boolean isPressed() } @Override - protected final SyEventConsumed onEvent( - final SyEventType event) + protected final SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowContentArea.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowContentArea.java index 2a69cabe..54ca32b4 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowContentArea.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowContentArea.java @@ -17,7 +17,7 @@ package com.io7m.jsycamore.vanilla.internal; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.themes.SyThemeClassNameStandard; import com.io7m.jsycamore.api.themes.SyThemeClassNameType; @@ -41,8 +41,8 @@ public final class SyWindowContentArea extends SyWindowComponent } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeE.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeE.java index 2d0d5a18..8e78baaf 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeE.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeE.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -54,13 +55,15 @@ public final class SyWindowResizeE } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof final SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeN.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeN.java index 8ec277fe..981415e2 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeN.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeN.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -56,13 +57,15 @@ public final class SyWindowResizeN } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNE.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNE.java index 09ad7fa9..6b4d157a 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNE.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNE.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -56,13 +57,15 @@ public final class SyWindowResizeNE } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof final SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNW.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNW.java index b00c0d31..27804313 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNW.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeNW.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -56,13 +57,15 @@ public final class SyWindowResizeNW } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof final SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeS.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeS.java index 9636f19c..56b23cb7 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeS.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeS.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -54,13 +55,15 @@ public final class SyWindowResizeS } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof final SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSE.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSE.java index a2425a0c..72202d71 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSE.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSE.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -54,13 +55,15 @@ public final class SyWindowResizeSE } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof final SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSW.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSW.java index 3e0a91f4..00ab9adb 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSW.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeSW.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -56,13 +57,15 @@ public final class SyWindowResizeSW } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeW.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeW.java index 54fc80d9..70129bd2 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeW.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowResizeW.java @@ -19,7 +19,8 @@ import com.io7m.jregions.core.parameterized.sizes.PAreaSizeI; import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -56,13 +57,15 @@ public final class SyWindowResizeW } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof final SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent( diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowRoot.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowRoot.java index b735ff39..2a8c9532 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowRoot.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowRoot.java @@ -20,7 +20,7 @@ import com.io7m.jsycamore.api.components.SyComponentType; import com.io7m.jsycamore.api.components.SyConstraints; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; import com.io7m.jsycamore.api.layout.SyLayoutContextType; import com.io7m.jsycamore.api.screens.SyScreenType; import com.io7m.jsycamore.api.spaces.SySpaceParentRelativeType; @@ -92,8 +92,8 @@ public final class SyWindowRoot extends SyWindowComponent } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { return EVENT_NOT_CONSUMED; } diff --git a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowTitle.java b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowTitle.java index 18885ad9..1232c0e1 100644 --- a/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowTitle.java +++ b/com.io7m.jsycamore.vanilla/src/main/java/com/io7m/jsycamore/vanilla/internal/SyWindowTitle.java @@ -20,7 +20,8 @@ import com.io7m.jsycamore.api.components.SyButtonReadableType; import com.io7m.jsycamore.api.components.SyTextViewType; import com.io7m.jsycamore.api.events.SyEventConsumed; -import com.io7m.jsycamore.api.events.SyEventType; +import com.io7m.jsycamore.api.events.SyEventInputType; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventOnHeld; import com.io7m.jsycamore.api.mouse.SyMouseEventOnPressed; import com.io7m.jsycamore.api.mouse.SyMouseEventOnReleased; @@ -86,14 +87,15 @@ public final class SyWindowTitle } @Override - protected SyEventConsumed onEvent( - final SyEventType event) + protected SyEventConsumed onEventInput( + final SyEventInputType event) { - if (event instanceof final SyMouseEventType mouseEvent) { - return this.onMouseEvent(mouseEvent); - } - - return EVENT_NOT_CONSUMED; + return switch (event) { + case final SyMouseEventType e -> { + yield this.onMouseEvent(e); + } + case final SyKeyEventType e -> EVENT_NOT_CONSUMED; + }; } private SyEventConsumed onMouseEvent(