[Bug] Note Types window moves down every time it is opened

Every time the Note Types window (Tools > Manage Note Types) is opened, it moves exactly 31 pixels down (on a 1080p monitor at least) in comparison to the previous instance until it eventually reaches the bottom of the screen and cannot go any further.

Tested using Anki 24.11 on Windows 11.

1 Like

Can confirm on debian linux (oldstable).

Funny bug you found!

That suspiciously seems to be the exact height of of the window title bar.

I wonder if when Anki shows the window it is using the wrong property / doing some incorrect maths which does not include the title bar.

1 Like

I made a fix:

1 Like

Thanks for taking quick action!

I haven’t looked at your code – but were you able to identify some change in 24.11 (or 24.06.3) that would have caused this – for this one window or for many? It seems like if it’s not happening in earlier versions [e.g. I can’t reproduce it in 24.06.2] – it would be good to identify the root of the issue.

This specific bug seems to have been caused in this commit (on 2024-08-05):

Setting window flags seems to make the window move down by the title bar height, so you have to restore geometry after setting them.

There may be similar bugs elsewhere, I have not checked all dialogs.

From a quick search there does not seem to be any other calls to setWindowFlags(...) in a dialog’s constructor, but modifying the window in other ways after restoring geometry might cause a similar bug.

1 Like

Great! That puts definitely as new in 24.11.

If I understand things in GitHub correctly (which is usually about 50/50 :sweat_smile:), it looks like that change was meant to give maximize buttons to a certain set of windows. If that same set of windows has this moving-down problem, your fix should probably fix it for them too, right?

That change only affected (and introduced the bug in) the “Note Types” window.

It is possible that other dialogs/windows have similar bugs, but with slightly different causes. The main ones (Add/Browse/Stats) seem fine, but I haven’t bothered to check every dialog.

2 Likes

Thanks for helping me close the loop on that!