Skip to content

Conversation

@joreg
Copy link
Contributor

@joreg joreg commented May 18, 2023

PR Details

Similar to #504, this adds touch support to the Winforms based GameForm.

Description

Adds a PointerWinfoms class (corresponding to the PointerSDL class) and adds FingerPress/Move/Release events to the GameForm class. The GameForm in its WndProc() listens to the WM_POINTER messages and fires the finger-events accordingly.

The GetFingerId() method is now shared by PointerSDL and PointerWinforms by having it moved to their baseclass: PointerDeviceBase.

Related Issue

Motivation and Context

The SDL based GameForm had touch support for a while now but it turned out that at least on Windows it has issues (probably due to the SDL2 touch implementation being based on the obsolete WM_TOUCH api). Sometimes touches would not be released, simple to reproduce by pressing ALT+Tab while having a finger on the screen.

This PR adds touch support based on the WM_POINTER api and does not show the same issue.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@joreg joreg marked this pull request as ready for review October 14, 2025 13:32
azeno added a commit to vvvv/VL.StandardLibs that referenced this pull request Oct 14, 2025
…and extend into title bar features. Merge once stride3d/stride#1664 is merged.
@tebjan tebjan requested a review from Copilot October 20, 2025 10:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds touch support to the WinForms-based GameForm using the WM_POINTER API, aligning it with the existing SDL touch functionality.

  • Introduces PointerWinforms and wires up touch press/move/release events from GameForm.
  • Moves GetFingerId logic to PointerDeviceBase for reuse across backends.
  • Adds Win32 interop (TouchUtils) and updates GameForm WndProc to dispatch finger events.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sources/engine/Stride.Input/Windows/PointerWinforms.cs New WinForms pointer device that listens to GameForm touch events and pushes normalized pointer events.
sources/engine/Stride.Input/Windows/InputSourceWinforms.cs Registers the new PointerWinforms device alongside keyboard/mouse.
sources/engine/Stride.Input/SDL/PointerSDL.cs Removes local GetFingerId in favor of base class implementation.
sources/engine/Stride.Input/PointerDeviceBase.cs Adds shared GetFingerId mapping for consistent finger indexing across backends.
sources/engine/Stride.Games/Desktop/Win32Native.cs Adds TouchUtils P/Invoke types and helpers for WM_POINTER.
sources/engine/Stride.Games/Desktop/GameForm.cs Adds touch events and WM_POINTER handling in WndProc to emit finger events.

joreg and others added 4 commits October 21, 2025 14:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@xen2 xen2 merged commit aaae940 into stride3d:master Oct 23, 2025
7 checks passed
xen2 added a commit that referenced this pull request Oct 23, 2025
Adds touch support to Winforms based GameForm
Acissathar added a commit to Acissathar/stride that referenced this pull request Oct 23, 2025
commit aaae940
Merge: ee81d20 325a7fa
Author: xen2 <virgile@stride3d.net>
Date:   Thu Oct 23 18:22:23 2025 +0900

    Merge pull request stride3d#1664 from vvvv/dev/joreg/add-touch-to-winforms

    Adds touch support to Winforms based GameForm

commit ee81d20
Author: Eideren <contact@eideren.com>
Date:   Wed Oct 22 16:18:35 2025 +0200

    fix: Instantiate() behavior for Prefab and Entity references (stride3d#2914)

commit 325a7fa
Merge: 77e2101 82f7fae
Author: joreg <joreg@vvvv.org>
Date:   Wed Oct 22 11:13:44 2025 +0200

    Merge branch 'dev/joreg/add-touch-to-winforms' of https://github.com/vvvv/stride into dev/joreg/add-touch-to-winforms

commit 77e2101
Author: joreg <joreg@vvvv.org>
Date:   Wed Oct 22 11:13:35 2025 +0200

    fixed potentially problematic cast

commit 82f7fae
Author: joreg <joreg@vvvv.org>
Date:   Wed Oct 22 11:12:19 2025 +0200

    Update sources/engine/Stride.Games/Desktop/GameForm.cs

    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

commit 1956f70
Author: joreg <joreg@vvvv.org>
Date:   Tue Oct 21 14:37:15 2025 +0200

    Update sources/engine/Stride.Input/Windows/PointerWinforms.cs

    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

commit 2c1bc62
Author: joreg <joreg@vvvv.org>
Date:   Tue Oct 14 15:22:12 2025 +0200

    Touch position is now normalized 0..1 like in other implementations

commit 13d11c8
Merge: c73271b b74a54d
Author: joreg <joreg@vvvv.org>
Date:   Tue Oct 14 14:05:36 2025 +0200

    Merge branch 'master' into dev/joreg/add-touch-to-winforms

commit c73271b
Author: joreg <joreg@vvvv.org>
Date:   Thu May 18 13:03:58 2023 +0200

    PointerSDL now uses GetFingerId() from baseclass (to be in line with Winforms implementation)

commit 4ab9f70
Author: joreg <joreg@vvvv.org>
Date:   Thu May 18 13:03:10 2023 +0200

    add touch support for Winforms based GameForm
@Eideren Eideren changed the title Adds touch support to Winforms based GameForm feat: Adds touch support to Winforms based GameForm Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants