Background update stealing focus

Started by AndyL, February 16, 2025, 12:31:30 PM

Previous topic - Next topic

AndyL

I have recently updated from version 2021 to 2025, via a few months of 2023.

I am having a problem when Imatch updates things in the background. I am finding that it's display flashes and worst of all, it steals focus from what I am doing elsewhere. I noticed it first in the 2023 version, but it has got worse in the new 2025 version to the point where I have had to turn off all the background scan for new files.

As an example, if I request a metadata writeback for all pending files I can see the categories window redrawing. While this is happening focus gets stolen from my typing in another window.

Something that may be unusual in my setup is that I always have focus follows mouse enabled.

Is there something I can change in Imatch to avoid this behaviour.

Thanks for any help

Mario

QuoteSomething that may be unusual in my setup is that I always have focus follows mouse enabled.
That might be it.
IMatch does not call WM_SETFOCUS when it updates windows at all. It does so, e.g. when it displays a notification or a dialog box. I have never used the "follow focus" feature. What is it good for, how does it change how Windows manages the "active" window, are the same Windows events generated and messages sent when this is active? I have no idea what this feature does.

Since no other user reported a similar problem, this might be something that happens only on your PC because of the unusual option you have enabled. Do you experience the same problem when you turn this feature off?

AndyL

Focus follows mouse does what it says :)

When you move the mouse pointer over a window, that window becomes active without you having to click in it.

You can turn it on by going to Control Panel->Ease of Access Centre->Make the mouse easier to use and tick Activate a window by hovering over it with the mouse

It is something I've used for as long as I can remember and would struggle to work without it.

I don't know if it changes any of the events generated, but it is a standard part of Windows, so presumably there is some documentation about it somewhere.

As I said, I didn't have this problem with the earlier versions of Imatch (or any other program for that matter), so it is something that has changed.

Regards

Mario

When IMatch updates "things in the background", a lot of stuff is going on. Every imported file, for example, will invalidate all categories and collections. And IMatch has to update the tree controls and panels, when they are visible. This is perfectly normal.
None of these operations "steals" the focus. Windows makes on window the focused window, based on user action.

When you request metadata write-back, IMatch shows a dialog box (unless you write only a few files). Is this the case?
The dialog becomes the focused window, and IMatch itself is blocked until the dialog is closed. The dialog shows the percentage of completion.

What do you do in this case with your mouse? Move to another application?
Which operations are processed in the background? Write-back, indexing files, face recognition?
What does the Info & Activity panel show when this happens?

IMatch does use the "SetFocus" windows function very sparingly and only in specific contexts, e.g. when setting back the focus to the File Window when a dialog was opened and then closes.

Under which conditions steals IMatch the focus and which window / panel / view becomes focused?
Background processing does not know anything about windows or panels, and hence this must be a side effect of something.

I've asked above if you experience this when this option is off?

I mean, I can move the mouse cursor over 30 windows in IMatch within a second, and when Windows focuses each of these windows, this will cause a lot of disturbance, maybe reloads of data since many panels update only when focused etc or whatnot.

I also have no idea how the Microsoft foundation classes IMatch use or the 3rd party user interface toolkit or the Chromium browser windows used for app panels and several views handle this option. There are so many layers.

I you can come up with a step-by-step of what to do to cause this effect and I can reproduce it here in the lab, I might be able to improve things. Since you are so far the only user reporting this, spending hours or days on trying to analyze this is probably not warranted. Step-by-step instructions would make this more likely to be solvable.

AndyL

The metadata writeback was and example of something that causes a problem. I request the writeback and it pops up a dialog box, I click OK and it starts working. I then move to the window of another program, e.g. notepad, and start typing. When Imatch finishes the writeback I can see the categories window "flashing" and my typing is no longer going to notepad.

I have seen similar issues just within Imatch. One example is when importing some new images I create a new keyword using the thesaurus to assign to some images. I do the assignment, then go to another image and edit the description. Part way through this something updates, again causing some visible redraw, and my typing no longer appears in the description box.

Another example I have just seen. I have a category selected to display some images. I then scroll the category window down to the "Face arrangement" category and notice it shows the refresh icon. I hover the mouse over that icon and it pops up some help about requiring a refresh. While I'm reading it, something updates, the category window refreshes and it scrolls back to the category currently selected.

Another similar annoyance. I have a number of new images which are in the Unassigned files category. I select that category and start to categorise them. Again, something in the background triggers an update and the images that have had a category applied disappear. This didn't used to happen. When an image needs to be assigned to more than one category this behaviour becomes a problem.

I have tried turning off focus follows mouse and is does appear to fix the problem, so it does look like this relates to the problem, so this should help you find what is going on.

Regards


Mario


QuoteWhile I'm reading it, something updates, the category window refreshes and it scrolls back to the category currently selected.

 That's to be expected. Something you have done required a category update, creation of new categories, removal of existing categories or whatever. The tree control in the category panel reloads and restores the last focused item and scrolls it into view.


QuoteI have a number of new images which are in the Unassigned files category. I select that category and start to categorise them. Again, something in the background triggers an update and the images that have had a category applied disappear. T
Also normal. You change the base of the category you work with (unassigned files, which you then assign). The File window receives information that the Unassigned category has changed and reloads.

This is not a good workflow.

If you intent to change the very base of the category you're working with, select all files with Ctrl + A and open them in a Result window with Ctrl+G, R (or the corresponding File Window context menu command or the Command Palette).

Now you can assign categories to the files as needed. Since the result window is not linked to the Unassigned category but independent, it will not reload when you remove a file from the Unassigned category.

AndyL

None of this happened before and none of it happens if I turn off focus follows mouse, so it is not "to be expected"

Regards

Mario

Quote from: AndyL on February 16, 2025, 08:34:35 PMNone of this happened before and none of it happens if I turn off focus follows mouse, so it is not "to be expected"

Regards
This is how IMatch always worked, since version 5.
To help users manipulating categories they view in File Windows, the option to open the files in Result Windows was added in IMatch 2018 or 2019, not sure.

If you load the unassigned category into a File Window and then change the unassigned category by assigning files from it to categories, the File Window will reload (timing will vary of course). Otherwise the File Window would show you files which are actually no longer in the category, and that would be bad.

AndyL

#8
Maybe the timing has changed then. The point is, with focus follows mouse enabled I am seeing lots of window refreshes and other behaviour that are causing problems and make things unusable. This did not happen with all the previous versions I used from at least Imatch 5 to 2021.

Perhaps you should try turning on focus follows mouse and see what I am talking about, after all this is a standard feature of Windows that every other program I use has no problem with.

Information about how to set things up can be found here..

https://winaero.com/enable-xmouse-window-tracking-windows-10/

The setup I use is under the heading "Make windows active but not raise them"

Regards

Mario

QuotePerhaps you should try turning on focus follows mouse and see what I am talking about, after all this is a standard feature of Windows that every other program I use has no problem with.
Yes, I will do that and see what I can learn.

Feel free to open a feature request so I can learn how many users use this Windows feature and are affected by it in the same way you are affected by it.
If this is something more than one user has to deal with, it will add some extra priority to the issue.

I will open a ticket with the 3rd party vendor of the user interface toolkit IMatch uses: It handles the focus processing, and they may be able to improve things in a future version.

Mario

I tried to reproduce this, but "focus" issues are super-complicated (almost impossible) to debug in development environments. Because, in order to debug things, the development environment (not IMatch) must have the focus.

Please attach a screen shot of IMatch as you use it. Can be an empty folder.
I need to see which panels are open, which ribbons are enabled, it search or filter ribbons are visible etc.

AndyL

A fairly typical image of how Imatch looks when I'm using it is attached.

Regards

Andy



Mario

Tip: Go to Edit > Preferences > Application and reduce the ribbon height a bit. This avoids ribbons wrapping into multiple rows.

AndyL

Thanks. Making it a bit smaller certainly improves things. Everything was at the default settings and I thought the new icons all looked a bit big. I need to spend some time going through all the new features.


Mario

Do you remember the default size IMatch has selected and what are your screen dimensions and DPI settings (display scaling)?

IMatch determines the default icon size based on the height of the menu font Windows uses and the minimum height for drop-down control elements. These are usually good measures, allowing IMatch to adapt for everything from 1600px to 4K, from 100% scaling to 300% scaling needed on some laptops to make text readable.

AndyL

I think it was 31. I've now set it to 20

My screen is 2560 x 1440 with the scale set to 100%

Regards

Mario

Thanks. Can you show me a screen shot of the File Window ribbon?

The minimal height is calculated from the minimal height of a combo box control and edit control (because they are not resizable and must fit into the ribbon). This is the minimal height you can set in the Application Preferences with the slider.
By default, IMatch adds two pixels to the minimal height to define the initial ribbon height. This usually ensures a balance between "clickabibilty" and screen estate usage.

If you can set it to 20 px (is this the minimum available), the initial size chosen should have been 22 pixel.
On my main monitor (4K), the minimum height is  26 pixel and the default is 28 pixel. I get the same on my 2560 x 1600 laptop with 150% scaling.

AndyL

Hopefully this image is what you wanted.

The minimum I can set is 16, the image is with is set to 20.

Regards



Mario

Minimum 16. +2 for the default. The default size should have been 18, not 31 or 32. Strange.

AndyL

I don't know if it makes a difference, but this wasn't a "clean" install. It was an upgrade from a previous version.

I don't think I have ever changed this setting, so it should have been the default.

Andy

Mario

Quote from: AndyL on February 27, 2025, 05:56:47 PMI don't know if it makes a difference, but this wasn't a "clean" install. It was an upgrade from a previous version.

I don't think I have ever changed this setting, so it should have been the default.

Andy

I considered that and checked if maybe the toolbar size used in IMatch up to 2023 is used as the default, but the settings are separate. I will do some texts with fresh installs to see if the defaults work as I intended them. The icons should only be two pixels larger than the combo box / edit height, else too much screen state is wasted (as was in your case).

AndyL

Some more things to throw into the mix. 

I also run Imatch on a laptop with a 1920x1080 display. The database gets copied between the two machines, always from the PC to the laptop.

I haven't got round to updating the laptop yet, it is still running 2023.14.2. I've just checked and the ribbon height is set to 32 and the display looks fine, not enlarged icons like the screenshot above. This also has a minimum setting of 16.

It is possible that in the past the settings data has been copied between the two machines and over the course of me using Imatch I have updated the monitor and PC, transferring Imatch from older machines to my current one.

So there's lots of places for things to go wrong.

Andy

Mario

IMatch 2023 has no ribbons, it uses toolbars with the more colorful old-style icons.

AndyL

Well the setting for Ribbon Height exists in 2023.14.2 and it is set to 32 on my installation.

Mario

Probably only a left-over and only when experimental features are enabled?