From 79c9e1dfbfea054fbeb7e9d35a3f46e20d1d844c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Thu, 12 Nov 2026 16:11:57 +0300 Subject: [PATCH] unify --- components/render/windows/renderAux.swift | 8 +++----- components/render/windows/view/RenderGLView.swift | 5 ++--- docs/components-over-platforms.md | 5 +++-- docs/hello-raylib.md | 4 +++- hello/hello-raylib/ver-windows/src/render/renderVM.swift | 2 +- .../hello-selection/ver-windows/src/render/renderVM.swift | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/render/windows/renderAux.swift b/components/render/windows/renderAux.swift index 73dbbac..82c741b 100644 --- a/components/render/windows/renderAux.swift +++ b/components/render/windows/renderAux.swift @@ -15,15 +15,13 @@ func renderRecreateSurface(_ vm: RenderVM) { glbriMakeCurrentContext(&vm.glView.st) } -func renderSetupWinUISignals(_ view: RenderGLView, acceptsPointerInput: Bool) { +func renderSetupWinUISignals(_ view: RenderGLView) { view.loaded.addHandler { [weak view] _, _ in view?.onLoaded() } view.sizeChanged.addHandler { [weak view] _, _ in view?.onSizeChanged() } view.unloaded.addHandler { [weak view] _, _ in view?.onUnloaded() } - if acceptsPointerInput { - view.pointerPressed.addHandler { [weak view] _, event in - view?.onPointerDown(event) - } + view.pointerPressed.addHandler { [weak view] _, event in + view?.onPointerDown(event) } } diff --git a/components/render/windows/view/RenderGLView.swift b/components/render/windows/view/RenderGLView.swift index 34ebb66..d160dac 100644 --- a/components/render/windows/view/RenderGLView.swift +++ b/components/render/windows/view/RenderGLView.swift @@ -6,14 +6,13 @@ final class RenderGLView: FrameworkElement { var rootChanged: EventCleanup? var st = GLBriState() - init(acceptsPointerInput: Bool) { + override init() { // swift-winui does not project SwapChainPanel, so wrap its native WinRT instance let panel: WindowsFoundation.IInspectable = try! RoActivateInstance( HString("Microsoft.UI.Xaml.Controls.SwapChainPanel") ) super.init(fromAbi: panel) - isHitTestVisible = acceptsPointerInput - renderSetupWinUISignals(self, acceptsPointerInput: acceptsPointerInput) + renderSetupWinUISignals(self) } func onLoaded() { diff --git a/docs/components-over-platforms.md b/docs/components-over-platforms.md index 25d7877..a1e55b0 100644 --- a/docs/components-over-platforms.md +++ b/docs/components-over-platforms.md @@ -942,8 +942,9 @@ through RoActivateInstance and wraps its IInspectable in FrameworkElement. The RenderView WinUIElementRepresentable returns that same VM-owned object. Its sizeThatFits accepts the offered dimensions because the empty panel has no intrinsic content size; WindowGroup.defaultSize supplies the initial proposal. -HRBApp places it first in ZStack and the shared title second. The panel disables -hit testing to leave input to the overlaid UI. +HRBApp places it first in ZStack and the shared title second. The panel uses +WinUI's default hit testing and registers the same pointer handler as +hello-selection. HRB has no rule that reacts to those presses. Loaded dispatches didPrepareWindowsGL. Its shared YAML rule emits didPrepareGL; the existing generated effects call renderInit, set VM.didPrepareGL and start diff --git a/docs/hello-raylib.md b/docs/hello-raylib.md index 3171524..48bfd03 100644 --- a/docs/hello-raylib.md +++ b/docs/hello-raylib.md @@ -393,7 +393,9 @@ The Swift WinUI projection used here does not expose SwapChainPanel directly. RenderGLView activates `Microsoft.UI.Xaml.Controls.SwapChainPanel` through `RoActivateInstance` and wraps its IInspectable as FrameworkElement. The `WinRTInternal` SPI exposes `init(fromAbi:)` and `_getABI()` for that integration. -The native panel disables hit testing, leaving overlaid UI available for input. +The native panel uses WinUI's default hit testing and shares its primary mouse +press handler with hello-selection. In hello-raylib, `mouseDownPos` has no +effect on the title or rendering. `Loaded` dispatches Windows preparation and an initial resize, and subscribes to `XamlRoot.Changed`. Subsequent SizeChanged/root events dispatch resize while the diff --git a/hello/hello-raylib/ver-windows/src/render/renderVM.swift b/hello/hello-raylib/ver-windows/src/render/renderVM.swift index d533365..c38d55d 100644 --- a/hello/hello-raylib/ver-windows/src/render/renderVM.swift +++ b/hello/hello-raylib/ver-windows/src/render/renderVM.swift @@ -5,7 +5,7 @@ final class RenderVM: ObservableObject { var didPrepareGL = false var frameCallback: EventCleanup? // WinUI controls must be created after the XAML runtime starts - lazy var glView = RenderGLView(acceptsPointerInput: false) + lazy var glView = RenderGLView() var pixelSize = [Int]() static private(set) weak var shared: RenderVM? diff --git a/hello/hello-selection/ver-windows/src/render/renderVM.swift b/hello/hello-selection/ver-windows/src/render/renderVM.swift index 9ce756a..bd59f87 100644 --- a/hello/hello-selection/ver-windows/src/render/renderVM.swift +++ b/hello/hello-selection/ver-windows/src/render/renderVM.swift @@ -7,7 +7,7 @@ final class RenderVM: ObservableObject { var didPrepareGL = false var frameCallback: EventCleanup? // WinUI controls must be created after the XAML runtime starts - lazy var glView = RenderGLView(acceptsPointerInput: true) + lazy var glView = RenderGLView() var items = [HSTItem]() var pixelSize = [Int]() var selectedItemId = -1