Repository navigation
Conversation
The color picker magnifier fix defaults to "auto", which applies it when WAYLAND_DISPLAY is set. Wine 11.16 and later leave WAYLAND_DISPLAY out of the Windows environment (ntdll's is_ignored_env_var), so under current Wine the fix was never applied and the zoom preview stayed black on Wayland. The XDG session variables still come through, prefixed WINE_HOST_; also accept WINE_HOST_XDG_SESSION_TYPE or XDG_SESSION_TYPE set to "wayland".
ColourPickerMagnifier.StartDragging hides the tool overlay (selection handles, outlines), and the first timer tick captures the canvas for the zoom preview; that capture is kept for the whole drag. Under Wine the canvas has usually not been redrawn without the overlay by then, so the preview showed the handles while the picked color came from the document under them. Drop the capture 50, 150, 300 and 600 ms into the drag, so the next tick takes it again from the redrawn canvas.
The color picker's magnifier is a topmost window. Under Wine, switching to another application does not end the pick, so the magnifier stayed above that application's windows. End it the way the tool does, by calling UserInterfaceService.ShowColourPicker(false) as a canceled pick, when the application is deactivated, and ignore requests to show it until the application is active again: the tool still sees the mouse over the canvas while Affinity is in the background.
A drag from a picker button, such as the one in the Colors panel, ends on mouse up or on lost mouse capture. After switching to another application the mouse comes up there, and under Wine the button keeps the capture, so the pick was still running on return. End it through the magnifier's OnFinishDragging(true), which makes the button release its capture as a canceled pick.
…_ACTIVATEAPP Application.Deactivated comes from WM_ACTIVATEAPP, a sent message, which can arrive inside ColourPickerMagnifier's timer tick while its SetWindowPos runs. Ending the pick there destroyed the magnifier window, and the rest of timer_Tick then dereferenced it: a NullReferenceException that took Affinity down. Defer the end with Dispatcher.BeginInvoke, as WPF's Popup does for the same message, and check that the application is still inactive and the same pick still running.
ColourPickerMagnifier.timer_Tick moves the magnifier window and then reads it. A tick delivered after the pick has ended and the window is gone throws a NullReferenceException, which takes Affinity down; this happened after switching applications mid-pick. Stop such a timer and skip the tick.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The color picker under Wine, especially on Wayland. Six WineFix commits on
dev, independent of #61 and #62. All of them have shipped in the AffinityOnLinux installer since early October.WAYLAND_DISPLAY, which Wine 11.16 and later leave out of the Windows environment. It now also acceptsWINE_HOST_XDG_SESSION_TYPE/XDG_SESSION_TYPE=wayland.Tested with Affinity 3.3 on Wine 11.19, KDE Plasma (Wayland).