Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to use the correct p/invoke for 32-bit #4600

Merged
merged 3 commits into from
Feb 10, 2022

Conversation

mattleibow
Copy link
Member

Description of Change

Windows uses 2 entirely different methods to set things like WndProcs: SetWindowLong on x86 and SetWindowLongPtr on x64.

Added a x86 Platform to the sample app so we can test this arch.

Additions made

  • Use the correct SetWindowLong vs SetWindowLongPtr depending on the arch
  • Added a helper GetWindowHandle extension method to platform Window

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the WinUI, Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might affect accessibility?

  • Does this PR introduce a new control? (If yes, add an example using SemanticProperties to the SemanticsPage)
  • APIs that modify focusability?
  • APIs that modify any text property on a control?
  • Does this PR modify view nesting or view arrangement in anyway?
  • Is there the smallest possibility that your PR will change accessibility?
  • I'm not sure, please help me

If any of the above checkboxes apply to your PR, then the PR will need to provide testing to demonstrate that accessibility still works.

@Redth Redth requested a review from marb2000 February 10, 2022 00:16

public static IntPtr GetWindowHandle(this UI.Xaml.Window nativeWindow)
{
var hwnd = nativeWindow.As<IWindowNative>().WindowHandle;

Choose a reason for hiding this comment

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

You can use the new WinRT Interop helpers and remove the IWindowNative definition:

 IntPtr hwnd = WinRT.Interop.WindowNative.GetWindowHandle(m_window);

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Updated to use that and deleted a file from our code.

@mattleibow mattleibow enabled auto-merge (squash) February 10, 2022 11:39
@Eilon Eilon added the legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) label Feb 10, 2022
@mattleibow mattleibow merged commit ba27206 into release/6.0.2xx-preview13 Feb 10, 2022
@mattleibow mattleibow deleted the dev/fix-x86 branch February 10, 2022 23:26
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@Eilon Eilon added the t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) label May 10, 2024
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants