* Don't tick with render loop when app is idle
* Update src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* wip
* wip
* api diff
* fixes
* Address review: clear wakeupPending at tick start, guard CarbonEmissionsHack subscriptions
- Clear _wakeupPending at start of TimerTick so wakeups already processed
by the current tick don't force an unnecessary extra tick
- Guard CarbonEmissionsHack against duplicate subscriptions using a private
attached property
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix lock-order inversion in Add/Remove vs TimerTick
Move Wakeup() and Stop() calls outside the _items lock in Add/Remove
to prevent deadlock with TimerTick which acquires _timerLock then _items.
Add/Remove are UI-thread-only so the extracted logic remains safe.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review: remove unused usings, guard double Stop(), fix SleepLoop extra frame
- Remove unused using directives from IRenderLoopTask.cs
- Guard TimerTick Stop() with _running check to prevent double Stop()
when Remove() already stopped the timer
- SleepLoopRenderTimer: use WaitOne(timeout) instead of Thread.Sleep
so Stop() can interrupt the sleep, and recheck _stopped before Tick
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix DisplayLinkTimer foreground handler bypassing render loop state
Only resume the display link on WillEnterForeground if the timer was
calling Start() to avoid setting _stopped=false when the render loop
had the timer stopped.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix DisplayLinkTimer thread safety, revert global NU5104 suppression
- Stop() now only sets _stopped flag; OnLinkTick() self-pauses the
CADisplayLink from the timer thread to avoid thread-affinity issues
- Revert NU5104 global suppression in SharedVersion.props
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Cap _ticksSinceLastCommit to prevent int overflow
Stop incrementing once it reaches CommitGraceTicks to prevent
wrapping negative and keeping the render loop awake indefinitely.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: remove Start/Stop from IRenderTimer, merge into Tick setter
Timer start/stop is now controlled entirely by setting the Tick
property: non-null starts, null stops. This eliminates the explicit
Start()/Stop() methods from IRenderTimer, making the API simpler.
DefaultRenderLoop controls the timer purely through Tick assignment
under its _timerLock. A new _hasItems flag tracks subscriber presence
since Tick is now transient (null when idle).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address review comments on timer thread safety and guards
- ChoreographerTimer: add _frameCallbackActive guard to prevent double
PostFrameCallback from both Tick setter and SubscribeView
- ServerCompositor: cap _ticksSinceLastCommit at int.MaxValue
- SleepLoopRenderTimer: make _tick volatile, remove _stopped recheck
(guard moved to DefaultRenderLoop)
- DefaultRenderLoop: add _running check at tick start to drop late ticks
- ThreadProxyRenderTimer: add lock for internal state manipulation
- DisplayLinkTimer: add lock for all internal state manipulation
- Re-add NU5104 suppression to SharedVersion.props
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: make _hasItems volatile for cross-thread visibility
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: guard against redundant starts in DefaultRenderTimer, make _tick volatile across all timers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove CarbonEmissionsHack, revert iOS/Android timers to always-ticking
- Delete CarbonEmissionsHack class and its XAML reference
- Revert DisplayLinkTimer (iOS) to original always-ticking implementation
- Revert ChoreographerTimer (Android) to original always-ticking implementation
- Add TODO comments for future start/stop on RenderLoop request
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix DirectCompositionConnection WaitOne not respecting process exit cancellation
Use WaitHandle.WaitAny with both _wakeEvent and cts.Token.WaitHandle so
the loop can exit when ProcessExit fires while the timer is stopped.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* timers
* XML docs
* Cache delegate
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Implemented new drawn window decorations API
TODO: check if it works on Win32, bring back titlebar automation peer
* Adjusting naming a bit
* Naming / configuration changes
* Various fixes
* popover fix?
* wip
* Address review
* Extra window roles
* WIP
* Fixed drawn titlebar automation
* Purge ExtendClientAreaChromeHints.
* Fixed dynamically enabling drawn decorations
* api diff
* Add automation IDs for drawn decorations buttons
* Resolved the issues
* build
* Retry a few times when Pager isn't available after test is finished
* Only do faulty test detection if asked
* duplicate package reference
* Try disabling faulty tests on appium1
* Fix ExtendClientAreaWindowTests
* Apply initial button states
* Enable CSD shadow for X11
* net8?
* Address review
* more review comments
* Moar review comments
* Extra hit-test checks
* Moar review
* Prefix integration test app exitfullscreen to avoid clashes
* Disable drawn decorations if parts = None
* Respect SystemDecorations value on mac in extend-client-area mode
* Tidy up logic a bit
* Adjust win32 tests to titlebar not being in the tree when CSD are not enabled
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* move gesture events from Gestures to InputElement. Fix holding gesture interactions with context menu
* update api diff
* address review comments
* fix some test types
* rename Cancelled to Canceled
* update api diff
* Make MathUtilities internal
* Remove old overloads from LayoutHelper
* Make DrawingContextHelper.WrapSkiaCanvas internal
* Update API suppressions
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Extracted IInputRoot out of TopLevel
* Move some input handling out of TopLevel
* Remove old class, make layout manager private
* Removed IRenderRoot
* Make VisualTreeAttachmentEventArgs a bit more sensible
* Move ILayoutRoot to PresentationSource
# Conflicts:
# tests/Avalonia.Controls.UnitTests/TabControlTests.cs
* Updated some VisualRoot / GetVisualRoot usages
* Updated more XxxRoot usages
* More Root usages
* Addressed review
* Hurr-durr xml
* More fixes
* Maybe fix android compilation
* API diff
* Yet another cast
* I had to use MSIL analysis to detect those casts
* Fixed automation
* Fix PointerOverPreProcessor
* Fix?
* Removed yet another cast to Visual
* The amount of random downcasts is astonishing
* Maybe fix mac
* Addressed review
* Native DockMenu code
* Add Native Interop
* Update ControlCatalog sample
* Add unit tests
* Add Action<IAvnMenu> to AvaloniaNativeMenuExporter
* Add dynamic dock item demo
* Move s_dockMenu reference to App
* Use Appium tests
* Revert INativeMenuExporterResetHandler
* Properly set the button for the checkbox
* Add dock test
* I hate Appium
* Rename NativeMenu.DockMenu to NativeDock.Menu
* Make static
* Remove Dock Click Test
* Add white space back for cleaner diff
* Reduce MenuExporter back to one
* Revert UpdateIfNeeded to private
* Revert QueueReset to private too... and fix some whitespace
* Revert IAvnMenuItem/IAvnMenu back
* That's what I get not comparing it to master
* And update this too
* Add documentation
* Remove netstandard2.0 from almost all projects
* Fix duplicated target frameworks in unit tests
* Fix DesignerSupport tests
* Fix Designer.HostApp packaging
* Build ControlCatalog.Desktop on CI
* Fix another bad auto merge
* Fix LeakTests duplicated target frameworks
* Don't hardcode target framework in DesignerSupportTests
* support reading images from clipboard(win32/android)
* Add DataFormat.Image. Prioritize png format when retrieving image from clipboard
* add browser support
* addressed comments
* win32 - add support for CF_DIB and CF_BITMAP formats
* win32 - add support for copying bitmaps to clipboard as DIB
* browser - add support for copying bitmap to clipboard
* Implement bitmap clipboard for iOS
* rename DataFormat.Image to DataFormat.Bitmap
* Implement Bitmap clipboard on macOS
* Use MemoryStream for bitmap clipboard/dnd on macOS backend
* Add public.jpeg support on macOS backend (convert it to png while in objc)
* Support TIFF format on iOS backend, by converting it to UIImage first
* Add Bitmap DND sample
* add clipboard bitmap support on linux
* simply bitmap format search on win32 clipboard
* fix linux clipboard image
* Bump MACOSX_DEPLOYMENT_TARGET
* Fix IDL incompatibility
* address review
* more reviews
* Fix Android crash on copy when a bitmap is present in the clipboard
* Handle any error that might occur pasting from an external content provider
* Add data transfer extension methods for Bitmap
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* new SuggestedFileType API
* Add impl for Win32 SuggestedFileType
* Impl suggestedFileType for GTK
* DBus impl
* Impl API for mac
* Add sample for suggested file filter
---------
Co-authored-by: Emmanuel Hansen <emmausssss@gmail.com>
* Add new SaveFilePickerWithResultAsync API to the base
* Add SaveFilePickerWithResultAsync stub impl
* Control Catalog SaveFilePickerWithResultAsync sample with XML and JSON types
* Make SaveFilePickerResult a struct
* Add managed picker implementation
* Make SaveFilePickerResult a readonly struct
* Windows implementation of SaveFilePickerWithResultAsync
* Test impl for dbus
* Reuse the file type object (FTO) so StorageFile consumer can match exactly the right FTO when receiving the SaveFilePicker's result.
* Add Gtk impl
* Avalonia.Native: surface selected save dialog filters
* macOS: report selected NSSavePanel filter
* Modify the conditional in case there's duplicate descriptions of FTO's in DBusSystemDialog.cs
* Instantiate FPFT as fallback
* Pass the mime/pattern to instantiated FPFT
* Update API diff
* Fix review comments
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* add SplitViewPanePlacement settings for Top and Bottom.
* remove duplicated styles.
* add missing transparent fills of lightdismiss area.
* add simple theme support for splitview pane placement top/bottom.
* Add unit test for all color format Brush parsing
* Support parsing all known color formats in Brush.Parse()
* Update property syntax
* Remove unnecessary usings
* Use an actual hex color
* Fix new brush test
* Switch order of brush parsing so known color optimizations are used
* Add more documentation comments to KnownColors
* Fix displayed text in BorderPage
InnerBorderEdge not InnerBorder
* Add CanMinimize and CanMaximize to Window
* Win32 impl for CanMinimize/CanMaximize
* Add CanResize/CanMinimize/CanMaximize samples to control catalog
* X11 impl for CanMinimize/CanMaximize
* macOS impl for CanMinimize/CanMaximize
* Win32: don't allow restore when the window isn't resizable
* Additional documentation for CanMinimize/CanMaximize
* Add CanMinimize/CanMaximize logic to CaptionButtons
* Use START_COM_ARP_CALL
* Added CanMinimize/CanMaximize integration tests
* Fixed CanMaximize tests on macOS
* IsEditable combox box with text bindings
* Update after #18405 api review
* ComboBox tests for IsEditable
* remove unneeded error being throw when combox is editable and doesn't have text binding properties
* Changes after code review
* only do naviagtion check if combo box is editable
* Fix editable ComboBox tab navigation
* combobox code review improvements
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* add lifetime with view factory on android
* rename android lifetime interface
* add warning when using ISingleViewApplicationLifetime for android, set current main activity reference on OnResume
* fix nit
* Only start ScrollGesture when left click pressed, also `GetCurrentPoint(null)` behaves the same as root visual
* Allow right-click pen to select items on press
* Add context menus to even items on ListBox page for testing
* Avoid global static in UpdateSelectionFromPointerEvent
* Revert "Avoid global static in UpdateSelectionFromPointerEvent"
This reverts commit 2562d73e83.
* Add comment to UpdateSelectionFromPointerEvent
* Use fully mocked rendering for list box test
* Add pen selection tests
* TouchTestHelper should use correct inputs
* Implemented IClipboard.TryGetInProcessDataObjectAsync for X11
* [Win32] Implemented TryGetInProcessDataObjectAsync
* Rest of the platforms
* Run `nuke ValidateApiDiff`
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* fix accelerator behavior for menu items and labels
* add elements with matching accelerator to test cycling in sub menus
* Add AccessKeyHandler tests for accelerators with more than one match
* Implement accelerator behavior based on WPF handling
* Remove commented code
* Remove OnAccessKey override => handled by DefaultMenuInteractionHandler
* remove obsolete test
* handle OnAccessKeyPressed for selected tab item
* fix unit tests
* use AccessKeyEvent instead of AccessKeyPressedEvent in unit tests
* navigate menu with and without ALT key
* Revert formatting changes in Tests
* Fix AccessKeyHandler comments
* move private types to bottom
* Remove lock statements, optimize removal of AccessKeyRegistrations
* remove call to Dispatcher.UIThread.Post
* simplifiy AccessKeyHandler.SortByHierarchy
* remove unnecessary method AccessKeyHandler.GetTargetsForSender
* regenerate API suppression file
* revert unneeded changes in MenuPage.axaml
* correct formatting changes
* do not sort by hierarchy if too few targets
* make AccessKeyEventArgs internal
* make AccessKeyPressedEventArgs internal
---------
Co-authored-by: Hans Docsek <hans.docsek@gmail.com>
* Do not reset the selected range when the TextBox loses focus
Do not render selection highlight when the TextBox doesn't has focus
* Invalidate TextLayout when the focus is lost
* Make ClearSelectionAfterFocusLost optional
Make inactive selection highlight optional
* Make sure changes to ShowSelectionHighlight invalidate the visual and text layout
* Add CustomPopupPlacement API
* Add Placement="Custom" support for Flyout, ToolTip and ContextMenu controls as well
* Adjust some API changes
* Add Avalonia.Controls.Primitives.IPopupHost.ConfigurePosition breaking change
* Extract new types into separated files
* Fix build after merge conflict
* Adjust nupkg.xml
* Dispose property subscriptions after popup is closed, avoiding flickering
* Adjust API to be more future proof and add new parameters.
* Add new ContextRequestedEventArgs overload while I am on it