Closed RawPerfect closed 2 months ago
Same for me. Unfortunately, #922 didn't fix #918 for me either. I hadn't had time yet to collect logs and downgraded for now.
The two times I ran post #922, things seemed similar to as described in #918. I.e., the flicker got progressively worse over time until Whim eventually freezes (possibly due to #941?).
I also noted some issues with the auto-updater ever since it was added that sound similar to the ones documented here. But I usually have it disabled so I hadn't paid much attention.
- Sometimes red border flickers continually
Same for me. Unfortunately, #922 didn't fix #918 for me either. I hadn't had time yet to collect logs and downgraded for now.
I really thought I fixed that - maybe I don't see it as much because I've got FadeEnabled = true
.
I checked your config @urob and it looks like you've also got FadeEnabled = false
.
Sometimes the whole window flickers and refreshes every couple seconds or so, making it almost unusable.
Do you mean that the window you're using, or the focus indicator window? If it is the window you're using, what sort of flickering do you mean?
Unrelated or older issues:
- the update widget thingie always tries to get me to update even when I click 'skip this update' or whatever it says, and also even after I'm already on the newest version.
Sorry yeah that sucks. I've only got Whim running on my dev machine so I haven't actually had the updater running recently. I agree with @urob, you're probably better off just disabling it until I get around to fixing it #728.
- Sometimes when switching to a workspace, it doesn't show the window content until I drag the window a bit to reset its position (this has always been the case since starting to use Whim). Some programs have this issue more than others - seems to happen quite often with TickTick for example.
I do want to fix this - it's annoying.
The two times I ran post #922, things seemed similar to as described in #918. I.e., the flicker got progressively worse over time until Whim eventually freezes (possibly due to #941?).
This bug is infuriating - there's a call to a Windows API which is just not behaving as it should. Might be a little bit of a rabbit hole. It'll be hard to check if it's fixed because I haven't yet identified a reliable way to reproduce it.
I'm also aware that the logs have become too noisy and unhelpful - I'll trim those down soon too.
Re: logs, what's the most helpful verbosity level? I have them set to DEBUG, which contributes to the noise I imagine.
Re: flickering, I'll try running on the latest version again sometime this weekend to get some logs and see if I can spot any pattern.
I just merged a change which means that Debug
should be less noisy compared to before.
My guess for the cause of this flickering is that Whim's core now queues up events on to be triggered to the main thread. This queueing can get backed up (probably the case of #941). As a result, the FloatingLayoutPlugin
receives a large batch of events, the last of which is only needed.
I intend to fix #941 first and then see if there's an elegant way of getting the focus indicator to only take the last event. I also intend to move up the change of making the focus indicator a real border (#669) because the way it's implemented as another window has sufficiently annoyed me.
I have some logs: whim20240709.log running on v0.6.27
(the latest release as of today).
This is right after a restart of Windows. There are only two open windows:
WindowsTerminal
on Workspace 1
(on primary monitor)Firefox
on Workspace 3
(on secondary monitor)Other than starting Whim, there is no keyboard or mouse interaction for the first 30 or so seconds. The only interaction is in the last 5 or so second to stop Whim.
The flickering was notable almost immediately and grew progressively stronger over the 30 seconds. I haven't tried in this session so as to not pollute the logs, but in earlier trials Whim was unresponsive at similar points.
Adding a screen cast showing the flickering and freezing of Whim. Both the Statusbar and hotkeys didn't seem to do anything while Whim remained frozen.
https://github.com/dalyIsaac/Whim/assets/978080/eed1599b-3969-40be-9b7e-7f5678c0bd3a
Interestingly, both the freezing and flickering stopped as soon as I closed Firefox. I have confirmed this in multiple repeats and every time the flickering starts once I open and focus Firefox and stops once I close Firefox again. I haven't explored long enough yet to see if there are other programs that trigger it (but OP mentions that Discord
is causing the flickering on their end).
Timeline in Video
4s
: Starting Whim11s
: Whim is fully started23s
: Flickering becomes noticable29s
: Trying to switch the Workspace via StatusBar, which doesn't do anything for now38s
: Closing Firefox42s
: Whim belatedly switches Workspace (requested at 29s
)46s
: Manually switch back to Workspace 3, which executes immediately. No more flickeringI had a go at analyzing the logs posted earlier. Ignoring DispatchEvents
and Pick
events, there are two common event chains that always occur in sequence:
[DBG] Store:77 [Dispatch] Entering task, executing transform DoWorkspaceLayoutTransform { WorkspaceId = 32592244-1c41-4c23-9670-ac15b68b32b1 }
[DBG] WorkspaceSector:86 [DoLayout] Doing layout
[DBG] WorkspaceSector:146 [DoLayout] Layout 3
[DBG] WorkspaceSector:155 [DoLayout] Starting layout for workspace 3
[DBG] WorkspaceSector:173 [SetWindowPositions] Setting window positions for workspace 3
[DBG] DeferWindowPosHandle:47 [.ctor] Creating new WindowDeferPosHandle
[DBG] SliceLayoutEngine:145 [DoLayout] Doing layout on (X: 3847, Y: 49, Width: 3826, Height: 2104) on Monitor[Bounds=(X: 3840, Y: 0, Width: 3840, Height: 2160) WorkingArea=(X: 3840, Y: 0, Width: 3840, Height: 2160) Name=\\.\DISPLAY1 ScaleFactor=150 IsPrimary=False], with 1 windows and 0 minimized windows
[DBG] DeferWindowPosHandle:88 [DeferWindowPos] Adding window 0x0001073C after 0x00000001 with flags
[DBG] WorkspaceSector:187 [SetWindowPositions] Window New Tab β Mozilla Firefox (firefox.exe) [4380] <MozillaWindowClass> {0x0001073C} has rectangle (X: 3854, Y: 56, Width: 3812, Height: 2090)
[DBG] DeferWindowPosHandle:112 [Dispose] Disposing WindowDeferPosHandle
[DBG] DeferWindowPosHandle:132 [Dispose] Setting window position 2 times for 1 windows
[DBG] NativeManager:80 [ShowWindowNoActivate] Showing window HWND 0x0001073C no activate
[DBG] NativeManager:80 [ShowWindowNoActivate] Showing window HWND 0x0001073C no activate
[DBG] DeferWindowPosHandle:168 [Dispose] Finished setting window position
[DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B for New Tab β Mozilla Firefox (firefox.exe) [4380] <MozillaWindowClass> {0x0001073C}
[DBG] Store:77 [Dispatch] Entering task, executing transform WindowMovedTransform { Window = New Tab β Mozilla Firefox (firefox.exe) [4380] <MozillaWindowClass> {0x0001073C} }
[DBG] WindowUtils:15 [GetMovedEdges] Trying to move window edges in direction of mouse movement
[DBG] WorkspaceSector:86 [DoLayout] Doing layout
[DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B for New Tab β Mozilla Firefox (firefox.exe) [4380] <MozillaWindowClass> {0x0001073C}
[DBG] Store:77 [Dispatch] Entering task, executing transform WindowMovedTransform { Window = New Tab β Mozilla Firefox (firefox.exe) [4380] <MozillaWindowClass> {0x0001073C} }
[DBG] WindowUtils:15 [GetMovedEdges] Trying to move window edges in direction of mouse movement
[DBG] WorkspaceSector:86 [DoLayout] Doing layout
This chain comes in two variations, differing in whether the first event selects the primary monitor (DISPLAY
) or secondary monitor (DISPLAY1
).
[DBG] WorkspaceManager:35 [ActiveWorkspace] Getting active workspace for monitor Monitor[Bounds=(X: 3840, Y: 0, Width: 3840, Height: 2160) WorkingArea=(X: 3840, Y: 0, Width: 3840, Height: 2160) Name=\\.\DISPLAY1 ScaleFactor=150 IsPrimary=False]
[DBG] FocusIndicatorWindow.xaml:33 [Activate] Activating focus indicator window
[DBG] DeferWindowPosHandle:47 [.ctor] Creating new WindowDeferPosHandle
[DBG] DeferWindowPosHandle:88 [DeferWindowPos] Adding window 0x000203D6 after 0x0001073C with flags SWP_NOREDRAW, SWP_NOACTIVATE
[DBG] DeferWindowPosHandle:112 [Dispose] Disposing WindowDeferPosHandle
[DBG] DeferWindowPosHandle:132 [Dispose] Setting window position 2 times for 1 windows
[DBG] NativeManager:80 [ShowWindowNoActivate] Showing window HWND 0x000203D6 no activate
[DBG] NativeManager:80 [ShowWindowNoActivate] Showing window HWND 0x000203D6 no activate
[DBG] DeferWindowPosHandle:168 [Dispose] Finished setting window position
Both chains are often followed and/or interrupted by two types of WhimException:15
. The precise handles differ, but here is an an example for either exception:
[DBG] WhimException:15 [.ctor] Window with handle 0x000203D6 not found.
[DBG] WhimException:15 [.ctor] Window was ignored by filter
Ignoring all such exceptions, the logs consist of alternating events of Show
and Hide
of the focus indicator, interspersed by the two types of chains. Interestingly, as the session continues the Hide
and Show
nest longer and longer stretches of the two chains, presumably causing the flickering.
Here's an excerpt of the cleaned-up log right after Whim completed the initialization. Note how most Hide
events are immediately followed by a Show
event, explaining why the flicker is barely noticeable at first.
(To keep the logs clean, I omit the actual HideWindow
event which is triggered by the Hide
event.)
-- Chain 2
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] MutableRootSector:65 [DispatchEventsFn] Dispatching events
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] MutableRootSector:65 [DispatchEventsFn] Dispatching events
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] MutableRootSector:65 [DispatchEventsFn] Dispatching events
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] MutableRootSector:65 [DispatchEventsFn] Dispatching events
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
Contrast this with an excerpt after about 30s. Here Hide
is often followed by Chain 1
and Chain 2
, before the indicator is shown again. My guess is that this explains the flickering.
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
-- Chain 2
[DBG] FocusIndicatorPlugin:137 [Hide] Hiding focus indicator
-- Chain 1
-- Chain 1
[DBG] FocusIndicatorPlugin:93 [Show] Showing focus indicator
Here's the full, clean-up log: debug.log (link to original log: whim20240709.log)
Just guessing here but it seems that the two event chains somehow seem to be circular, keeping triggering new of the same event chains that eventually overload the system. I tried disabling the FocusIndicator
plugin and indeed would still eventually encounter the freezing when Firefox was opened (though it tends to take longer until it happens).
I've been hunting down why Firefox behaves atypically compared to other windows. There are a few issues I've found (and corroborated with Firefox's source code):
WindowMoved
[Source]The prior approach was for Whim to retry laying out the window after a timeout. This was not a good solution. My current plan is to add a way to ignore window events for different applications. That would work away some of the atypical events which can occur during operation:
2024-07-25 21:55:26.324 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B (EVENT_OBJECT_LOCATIONCHANGE) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:26.427 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x0003 (EVENT_SYSTEM_FOREGROUND) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:26.605 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B (EVENT_OBJECT_LOCATIONCHANGE) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:26.646 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B (EVENT_OBJECT_LOCATIONCHANGE) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:27.317 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B (EVENT_OBJECT_LOCATIONCHANGE) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:27.399 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x8018 (EVENT_OBJECT_UNCLOAKED) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:28.395 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B (EVENT_OBJECT_LOCATIONCHANGE) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:29.473 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x0003 (EVENT_SYSTEM_FOREGROUND) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:30.884 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B (EVENT_OBJECT_LOCATIONCHANGE) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:31.054 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x8002 (EVENT_OBJECT_SHOW) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:31.610 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x800B (EVENT_OBJECT_LOCATIONCHANGE) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
2024-07-25 21:55:31.805 +10:00 [DBG] WindowEventListener:135 [WinEventProc] Windows event 0x8017 (EVENT_OBJECT_CLOAKED) for Firefox Developer Edition (firefox.exe) [24884] <MozillaWindowClass> {0x00A407C0}
Just guessing here but it seems that the two event chains somehow seem to be circular, keeping triggering new of the same event chains that eventually overload the system.
I agree. There was an earlier case where enqueueing lots of callbacks onto the main thread caused a crash. This will be similar.
Tiny observation: While the FocusIndicator
now generally works with Firefox, it is only correctly activated when Firefox is focused via Whim. If it is focused via other methods (e.g., via mouse or Alt+Tab
), the FocusIndicator
continuous to be displayed around the previously focused window. Not a big deal, but perhaps worth tracking as a separate (low-priority) issue?
While the FocusIndicator now generally works with Firefox, it is only correctly activated when Firefox is focused via Whim.
From my investigation, it seemed that this occurred when Firefox was already started before Whim started. I've pushed a fix in #958 so that the custom startup processing logic is ignored if the Firefox window is already open when Whim starts.
There are still some flickering that I've noticed when Firefox (and I'm assuming other windows) start up for the first time. I've got some changes planned to reduce the amount of events emitted to the focus indicator which should ameliorate the flickering.
I've pushed a fix in #958 so that the custom startup processing logic is ignored if the Firefox window is already open when Whim starts.
Thanks! That fixed it for me, too.
Is there an existing issue for this?
Behavior
Buggy since an update or two ago (I think .20).
I keep having to quit out of whim because it's so bad.
Unrelated or older issues:
the update widget thingie always tries to get me to update even when I click 'skip this update' or whatever it says, and also even after I'm already on the newest version.
Sometimes when switching to a workspace, it doesn't show the window content until I drag the window a bit to reset its position (this has always been the case since starting to use Whim). Some programs have this issue more than others - seems to happen quite often with TickTick for example.
Config
Environment
Steps To Reproduce
The flickering seems to occur most often when I have discord open. The non flickering issues just happen throughout normal usage with programs which were redirected to certain workspaces. Maybe worth nothing that some of the programs, like TickTick, I have a shell script open on startup. Could have something to do with it.
Anything else?
No response