Граф коммитов

504 Коммитов

Автор SHA1 Сообщение Дата
Nikita Tsukanov 42b7b5eacb
Added generate-headers.sh for convenience purposes (#17413) 2024-11-03 13:01:51 +01:00
Nikita Tsukanov 4684d9e81e
Create an autorelease pool for every render timer tick (#17414) 2024-11-02 15:14:56 -07:00
Steven Kirk cb4b69894a
Ensure field is initialized. (#17218) 2024-10-08 14:14:52 -07:00
Nikita Tsukanov b17153f9aa
Don't apply our weird window positioning hacks for clicks on traffic lights (#17181)
This hack fixes the minimize problem with macOS 15.0
2024-10-03 08:15:03 +00:00
ahopper 05389af98e
Fix AutomationProperties.HelpText on macos (#17046)
* fix Automation.HelpText on windows

* fix AutomationProperties.HelpText on macos

* change breaking abstract to virtual

* only fall back to tooltip if string

* remove duplicate override

* fix AutomationProperties.HelpText on macos
2024-09-24 09:21:31 +00:00
Nikita Tsukanov e2a07cc04d
[AVN] Introduced ComObjectWeakPtr (#17041) 2024-09-24 09:17:47 +00:00
Steven Kirk 8c043d5900
Call layer.setNeedsDisplay on show. (#17096)
The `AvaloniaNative.GlPlatformSurface.CreateGlRenderTarget` method can only be called on the UI thread. In normal circumstances this method is called in response to a call to `TopLevel.HandlePaint` from the native `AvnView.updateLayer` method. However, a customer was experiencing a problem where `AvnView.updateLayer` and by extension `TopLevel.HandlePaint` were being called before the window is shown. This broke the creation of the GL render target.
2024-09-23 17:28:23 +00:00
Julien Lebosquain 49fb9ff34c
[macOS] Fixes stuck mouse buttons after drag (#17035)
* Reset pressed mouse buttons on drag on macOS

* Make draggable borders easier to click in ControlCatalog
2024-09-18 10:08:20 +00:00
Julien Lebosquain a31ff27fdf
Fixes stuck modifier keys on focus lost on macOS (#16788)
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
2024-09-11 20:00:53 -07:00
Steven Kirk c6cdbfec3b
Add basic integration tests for NativeControlHost and improve its automation/a11y support. (#15542)
* Added embedding page to IntegrationTestApp.

Currently embeds a lone native text box, and only when running on Windows.

* Win32 automation support for native control host.

Allows native controls to appear in the Avalonia automation tree as a child of the `NativeControlHost`. They also appear in the _wrong_ place - as a direct child of the `Window` - but this appears to be expected behavior as it happens when hosting a win32 control in WPF as well.

* Basic native control integration test on win32.

* Test editing native win32 control in popup.

* Add embedded text box on macOS.

* macOS automation support for native control host.

Implements special-casing of `InteropAutomationPeer`on macOS.

* Make native control integration test work on macOS.

The test for the native control in a popup is disabled on macOS because we have a bug there.

* Add missing parts

* Fix build error

* Skip test to see if CI passes again.

* Log more info about integration tests on win32.

* Try to fix flaky test.

* The tests won't yet work on macOS yet.

Will require #16577.

---------

Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
Co-authored-by: Max Katz <maxkatz6@outlook.com>
2024-08-05 11:32:20 -07:00
Ikko Eltociear Ashimine fc70228dc9
chore: update comimpl.h (#16011)
beggining -> beginning
2024-07-29 20:39:38 +00:00
Benedikt Stebner 4b494d9edb
Make sure Popups do not attempt to take focus when they are shown (#16365)
Co-authored-by: Max Katz <maxkatz6@outlook.com>
2024-07-21 04:25:42 +00:00
Max Katz 32c2f08200
MacOS sandboxing feature (#16090)
* Set isDirectory:true explicitly to help [NSURL fileURLWithPath] method

Might solve some rare/random issues with initial directory not being applied

* Fix dialogs page incorrectly setting parent folder

* Move SecurityScopedStream out of iOS project and share it with macOS project

* Refactor BclStorageItem to be more reusable across platforms

* [Breaking] Set BclStorageItem.CanBookmark to false, as it never was supposed to be true. Plain BCL doesn't provide files bookmarking.

* Reimplement storage provider support on macOS, support (optional) sandboxing

* Fix build

* Fix AppSandboxEnabled=false usage

* Re-enable BCL bookmarks, keep them base64

* Fix nullable error

* Prefix all bookmarks with a platform key

* Fix devtools breaking sandboxed app

* Try to read errors after saving bookmark

* Don't crash sample app if has no access

* Add internal IStorageItemWithFileSystemInfo abstraction

* Log information if OpenSecurityScope returned false

* Fix build

* Prefix bookmarks with "ava.v1."

* Support opening old-style bookmarks to avoid breaking changes
2024-07-18 18:03:52 -07:00
Max Katz 05ac6d2f1d
Screens API refactor (#16295)
* Draft new API

* Push reusable ScreensBaseImpl implementation

* Fix tests and stubs

* Update ScreensPage sample to work on mobile + show new APIs

* Reimplement Windows ScreensImpl, reuse existing screens in other places of backend, use Microsoft.Windows.CsWin32 for interop

* Make X11 project buildable, don't utilize new APIs yet

* Reimplement macOS Screens API, differenciate screens by CGDirectDisplayID

* Fix build

* Adjust breaking changes file (none affect users)

* Fix missing macOS Screen.DisplayName

* Add more tests + fix screen removal

* Add screens integration tests

* Use hash set with comparer when removing screens

* Make screenimpl safer on macOS as per review

* Replace UnmanagedCallersOnly usage with source generated EnumDisplayMonitors

* Remove unused dllimport

* Only implement GetHashCode and Equals on PlatformScreen subclass, without changing base Screen
2024-07-16 15:48:18 -07:00
Benedikt Stebner 3eda9a0e22
Fix embedded TopLevel coordinate conversion (#16181)
* Fix embedded TopLevel coordinate conversion

* Adjust client / screen coordinate conversion

* Remove commented code
2024-07-04 16:03:56 +00:00
Max Katz 3124c8d4fe
Set isDirectory:true explicitly to help [NSURL fileURLWithPath] method (#16061)
Might solve some rare/random issues with initial directory not being applied
2024-06-27 23:38:23 -04:00
Lubomir Tetak b1e96ad6ef
Notify window on mouseEntered (#15251) 2024-06-25 12:45:51 -07:00
Steven Kirk aab93ff16e
macOS: Don't include two windows in a11y tree. (#15899)
* Don't include two windows in a11y tree.

`AvnRootAccessibilityElement` has been removed and now `AvnWindow` handles the accessibility protocol itself, exposing its children via the `AvnView`.

* Remove hack now that issue is fixed.

* Fix build errors after merge.
2024-06-25 11:49:37 +00:00
Benedikt Stebner 143399f65a
Avalonia.Native TopLevel embedding (#15932)
* Introduce Avalonia.Native TopLevelImpl

* Update Avalonia.Native.csproj

Revert change
2024-06-19 19:55:59 -04:00
Bartosz Korczyński 7a7ab8e5f8
feat: Add API for fetching window Z-order (#14909)
* feat: Add API for fetching window Z-order

* Addressed PR comments

* Improve X11Window::ZOrder implementation to avoid traversing windows that are not required to compute z-order

* Move zOrder API from Window to IWindowingPlatform

* Revert "Addressed PR comments"

This reverts commit 691541adf6.

* Rename

* Missing methods

* Move GetWindowsZOrder from IWindowingPlatform to IWindowImpl

* Cleanup

* Move SortWindowsByZOrder to Window class as a static method

* Implement zOrder for HeadlessWindowImpl

---------

Co-authored-by: Max Katz <maxkatz6@outlook.com>
2024-04-19 18:07:04 -07:00
Nikita Tsukanov 27e40b820e
Create a new run loop observer for a nested loop if it's being started from an observer callback (#15425)
Co-authored-by: Nikita Tsukanov <kekekeks@Nikitas-MacBook-Pro.local>
2024-04-18 12:58:04 +00:00
Max Katz e3e42b2c15
Properly rethrow RegisterTick errors instead of returning generic E_FAIL (#14938) 2024-03-24 23:51:32 -07:00
Max Katz 83c11750a8
CAMetalLayer should not be opaque (#14761) 2024-03-05 19:55:17 -08:00
Max Katz 326ef7c9fd
Add .NET 8 target (Avalonia 11.1) (#14535)
* Add .NET 8 target to packable projects

* Update test projects

* Update sample projects to target .NET 8

* Update main Avalonia package to target .NET 8 as well

* Remove MSBuildEnableWorkloadResolver hack and some minor change

* Use net8.0 in nuke build as well

* Pin 8.0.0 SDK

* Adjust API validation

* Pin a valid version

* Remove net461 target from Avalonia package

* Remove unused net6.0 target from Avalonia.Designer.HostApp

* Adjust API diff

* Update ControlCatalog.Android.csproj

* Remove MSBuildEnableWorkloadResolver

* Fix Browser issues on .NET 8

* Fix .NET 8 error

* Fix merge conflicts

* Replace explicit TFMs in .csproj files with a centralized registry

* Fix merge conflict

* Fix AvsLegacyWindowsTargetFrameworks and add hacks for the tests

* Update XCode project CommandLineArgument

---------

Co-authored-by: Nikita Tsukanov <keks9n@gmail.com>
2024-03-05 13:37:26 -08:00
Max Katz 628a62e250
Implement MacOSProperties.IsTemplateIcon attached property on TrayIcon (#14348)
* Implement MacOS.IsTemplateIcon attached property on TrayIcon

* Use MacOS.IsTemplateIcon in the ControlCatalog

* Rename MacOS to MacOSProperties

* Extract IsTemplateIcon to ITrayIconWithIsTemplateImpl
2024-02-20 10:53:28 +00:00
Rosentti d6f5e7ddb6
IsVisible for NativeMenuItem(s) (#14567)
* IsVisible for nativemenuitems

* implementation for windows

* Update native/Avalonia.Native/src/OSX/menu.mm

Co-authored-by: jp2masa <jp2masa@users.noreply.github.com>

* Update menu.h

* address review changes

* add hidden option to ControlCatalog

---------

Co-authored-by: jp2masa <jp2masa@users.noreply.github.com>
Co-authored-by: Max Katz <maxkatz6@outlook.com>
2024-02-20 07:33:29 +00:00
workgroupengineering bbef4bbf83
fix(macOS): map CursorDragMove to openHand (#14623)
* fix(macOS):  map CursorDragMove to openHand

* fix: Address review
2024-02-17 10:39:47 +00:00
Dan Walmsley 6513f71a7a
fix macos crash at startup by not parsing all app arguments into uris. (#14494) 2024-02-05 13:11:28 -08:00
Benedikt Stebner f9c89b1ebb
[Mac] Make sure emulated text input is generated after key down (#14407)
* [Mac] Make sure emulated text input is generated after key down

* Don't send AvnKeyEnter as line breaks

* Revert some changes
2024-01-31 23:07:55 +00:00
Dan Walmsley 0e014f9cb6
Add an event so that users can detect when an Application icon is clicked (#14106)
* Add an event so that users can detect when an Application icon is clicked.

* refactor to use Lifetime apis.

* use ActivationKind instead of reason to be consistent with other xaml platforms

* implement macos raise url events.

* add docs.

* add apis to programatically Activate and Deactivate the application.

This allows the dock icon to be kept in sync so its menu options there say "Hide" / "Show" correctly.

* fix api naming.

* Add Browser IActivatableApplicationLifetime impl

* Implement IActivatableApplicationLifetime on Android

* Add IActivatableApplicationLifetime iOS implementation

* Adjust android impl a little

---------

Co-authored-by: Max Katz <maxkatz6@outlook.com>
2024-01-10 00:06:07 -08:00
Steveice10 e0c6e11a42
Add tooltip support to NativeMenuItem. (#13350)
* Add tooltip support to NativeMenuItem.

* Add support for NativeMenuItem tooltips on macOS.
2023-10-24 05:12:56 +00:00
Benedikt Stebner 26035be849
[Mac] Fix keyDown event (#13280)
* [Mac] Check for space key when keyDown isn't consumed

* [Mac] Make sure no text input event is send when a modifier is pressed

* [Mac] Refactor keyDown handling

* Move ignoreUserInput

* Handle keyDown for doCommandSelector
2023-10-18 10:03:45 +00:00
Benedikt Stebner b18d2f74f3
[Mac] Handle control keys all the time (#13220)
Co-authored-by: Dan Walmsley <dan@walms.co.uk>
2023-10-12 20:39:47 +00:00
Max Katz adb97bd5b6
Fix macOS clipboard formats mapping (#13197)
* Implement macOS clipboard formats mapping

* Mark DataFormats unstable instead of obsolete (removes warnings in our code base)

* Support non-text data formats in macOS drag source

* Implement SetStrings for IAvnClipboard to support files properly

* Add comments to a confusing part of code

* Update src/Avalonia.Base/Input/DataFormats.cs

---------

Co-authored-by: Jumar Macato <16554748+jmacato@users.noreply.github.com>
Co-authored-by: Dan Walmsley <dan@walms.co.uk>
2023-10-12 14:15:56 +00:00
Benedikt Stebner be0d00232a [Mac] Only raise TextInput for non empty keySymbol 2023-10-09 12:10:10 +02:00
Benedikt Stebner 4ef901b22b
Always process key events via input context unless it is disabled by user code (#13143)
Simulate textInput when IME is disabled
2023-10-06 09:47:01 +00:00
Steven Kirk 965276d616
Disallow entering fullscreen when showing window. (#12865)
Fixes hard-to-reproduce problem when showing a window while on a fullscreen space.
2023-09-30 07:33:09 +00:00
Max Katz cd4bf7a02b
MacOS file type filter in native file dialog (#12899)
* Introduce IFilePickerFileTypes to have more control over file types in the native backend

* Update samples page for dialogs

* Rename to IAvnFilePickerFileTypes

* WIP

* Fix disabled popup

* Explicitly dispose AvnString and AvnStringArray + GetNSArrayOfStringsAndRelease

* Fix potential crash

---------

Co-authored-by: Jumar Macato <16554748+jmacato@users.noreply.github.com>
2023-09-28 16:45:12 +00:00
Julien Lebosquain ac00fe2bf4
Key handling improvements (#12549)
* Physical key handling for Windows

* Physical key handling for macOS

* Physical key handling for X11

* Physical keys: cleanup unused keys

* Key symbols: ensure consistent behavior between platforms

* Fix dead key symbol for Windows

* Physical key handling for browser

* Physical keys: use new overloads where possible

* Key symbol for VNC

* Physical key handling in previewer

* Key symbol for forwarded X11 IME key

* Key symbol for Android

* Obsolete old RawKeyEventArgs ctor

* Fix key symbols for macOS with modifiers

* Adjust PhysicalKey members naming

* Use explicit std::hash for AvnKey/AvnPhysicalKey

Should hopefully satisfy the older compiler on the CI server

* Headless: added KeyPressQwerty

---------

Co-authored-by: Dan Walmsley <dan@walms.co.uk>
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
2023-09-22 13:43:37 +00:00
Tako b15ee692da
Add support for setting tooltip text for TrayIcons (#12948) 2023-09-20 09:28:48 +00:00
Benedikt Stebner c1ab50b08f
[Mac] Rework raw keyDown/textInput handling (#12774) 2023-09-20 09:17:19 +00:00
Steven Kirk 84320594bb
Don't clear clipboard in SetText. (#12866)
The managed part is responsible for clearing the clipboard, and does so. In addition, `SetBytes` doesn't clear the clipboard.
2023-09-13 14:44:52 +00:00
Max Katz d07e59bc5e Implement CVDisplayLink based timer on macOS 2023-08-24 01:36:03 -07:00
Hanjiang Yu f895661879 Fix main loop cancellation from another thread 2023-08-18 17:02:17 +08:00
Dan Walmsley e0ffb920a9 fix macos keydown and textinput events being raised in the wrong order. 2023-08-16 13:26:40 +01:00
Steven Kirk 40a35491f3 Merge branch 'master' into feature/embedded-automation-roots 2023-08-01 23:16:40 +02:00
Steven Kirk 1b2d3948d0 Fix accessibilityWindow.
Seems it was broken before and always would have returned null.
2023-07-28 00:41:16 +02:00
Steven Kirk 2c91d7f893 Handle null from RootProvider_GetWindow. 2023-07-26 12:45:58 +02:00
daniilpavliuchyk 5d2b9edec3 Fix window incorrect positioning with window startup location CenterScreen on MacOS 2023-07-25 19:27:16 +03:00
Julien Lebosquain e16deecd6a
Use ProcessExit to cleanup the native resources 2023-07-19 12:05:49 +02:00