MantisBT - Doomseeker
View Issue Details
0003771Doomseeker[All Projects] Bugpublic2020-03-22 08:572024-11-03 19:11
WubTheCaptain 
Zalewa 
nonetweaksometimes
closedinvalid 
Debian GNU/Linuxbullseye/sid
1.3.1 
1.4.0 
0003771: "Put populated servers on top" has regressed to require UI interaction for focus on startup
As far as I remember, Doomseeker has always had this quirky behavior where the "put populated servers on top" option for server filtering requires focus on the UI window (server browser) to refresh the server browser view (to sort by populated servers). This is most noticeable if Doomseeker is allowed to update the servers in background, while another window (e.g. a game) is in focus.

The behavior described earlier isn't an issue and is considerably normal behavior, because mouse cursor focus on the window would immediately put populated servers on top.

A regression somewhere has caused to require UI interaction on startup, e.g. a mouse cursor click, to update the server browser view and put populate servers on top. But only under obscure conditions, such as starting Doomseeker from dmenu instead of a shell/terminal emulator. Mouse wheel scrolling in the server browser doesn't count as focus. This "require UI focus on startup" didn't use to be reproducible this way few months ago on my system.

This is reproducible with a new configuration, so it seems not an issue with my configuration.
  1. Sort by lowest ping. Clear any additional sorting. (The default new configuration will get you far.)
  2. Because of another bug, the server filtering checkbox "put populated servers on top" shouldn't matter. Still, for the sake of reproduction let's assume it's enabled (because it is enabled in the default configuration).
  3. Close Doomseeker.
  4. Start dmenu (default keybinding in i3-wm: $mod + D, aka Mod4 + D, aka Meta key + D) and run Doomseeker.
  5. Notice servers are being populated to the server browser (with Internet connection), but the populated servers are not at the top. If not, reattempt few times.
  6. Click anywhere or gain window focus some other way, then notice the populated servers jump to top. The most clear indicator of this happening is the "Server name" textbox in server filter gaining focus, and you can start typing.


Repeat from a shell/terminal emulator and the issue can't be reproduced.

The "filtering enabled" option in server filter does not need to be checked, it's unrelated and has no effect on reproduction. (It filters by "max. ping" alright on startup, without need for focus, while filtering is enabled.)
Qt 5.12.5.
No tags attached.
png issue-3771.png (662,654) 2020-03-22 09:27
/tracker/file_download.php?file_id=2568&type=bug
Issue History
2020-03-22 08:57WubTheCaptainNew Issue
2020-03-22 09:27WubTheCaptainFile Added: issue-3771.png
2020-03-22 09:27WubTheCaptainNote Added: 0021228
2020-03-22 09:28WubTheCaptainNote Edited: 0021228bug_revision_view_page.php?bugnote_id=21228#r13043
2020-03-22 09:33WubTheCaptainNote Added: 0021229
2020-03-22 09:34WubTheCaptainNote Edited: 0021229bug_revision_view_page.php?bugnote_id=21229#r13045
2020-06-08 12:11ZalewaNote Added: 0021430
2020-06-08 12:13ZalewaNote Edited: 0021430bug_revision_view_page.php?bugnote_id=21430#r13182
2020-06-08 13:56WubTheCaptainStatusnew => feedback
2020-06-08 13:58ZalewaNote Edited: 0021430bug_revision_view_page.php?bugnote_id=21430#r13187
2020-06-08 15:06ZalewaNote Edited: 0021430bug_revision_view_page.php?bugnote_id=21430#r13195
2020-06-09 10:11WubTheCaptainNote Added: 0021455
2020-06-09 10:11WubTheCaptainStatusfeedback => new
2020-06-09 10:11WubTheCaptainNote Edited: 0021455bug_revision_view_page.php?bugnote_id=21455#r13203
2020-06-09 10:13WubTheCaptainNote Edited: 0021455bug_revision_view_page.php?bugnote_id=21455#r13204
2020-06-09 13:14ZalewaNote Added: 0021457
2022-09-10 15:29ZalewaNote Added: 0022386
2022-09-10 15:29ZalewaStatusnew => resolved
2022-09-10 15:29ZalewaFixed in Version => 1.4.0
2022-09-10 15:29ZalewaResolutionopen => invalid
2022-09-10 15:29ZalewaAssigned To => Zalewa
2022-09-10 15:30ZalewaNote Edited: 0022386bug_revision_view_page.php?bugnote_id=22386#r13719
2024-11-03 19:11ZalewaStatusresolved => closed

Notes
(0021228)
WubTheCaptain   
2020-03-22 09:27   
(edited on: 2020-03-22 09:28)
issue-3771.png is a screenshot from startup, without gaining focus.

To get this screenshot, I had to use delay:
maim -u --delay=30 | xclip -selection clipboard -t image/png

I then cropped the image in an image editor.

(0021229)
WubTheCaptain   
2020-03-22 09:33   
(edited on: 2020-03-22 09:34)
issue-3771.png also happens with "put populated servers on top" disabled, because of issue 0003772 they are treated as enabled, so as I said in the steps to reproduce, it shouldn't matter.

(0021430)
Zalewa   
2020-06-08 12:11   
(edited on: 2020-06-08 15:06)
Server sorting is turned off when Qt tells us that the main window is not active. We check this property:'https://doc.qt.io/qt-5/qwidget.html#isActiveWindow-prop [^]'

So far in all cases when the program was launched, the OS would give it the focus and this property would return true. dmenu launch doesn't seem to give focus to Doomseeker's main window and this causes the described problem. This effect can also be triggered manually: simply launch Doomseeker through "normal" means and then quickly click away so that the window loses focus.

I'm not certain if this is something we should attempt at fixing. If this is the way dmenu launches the app, it may be either a dmenu bug or an intended dmenu behavior.

As a workaround, it would technically be possible to forcibly steal the focus in MainWindow::postInitAppStartup(), but this actually interferes with the OS behavior and may cause some difficult to predict side-effects that may not be desireable.

Alternatively, we could remove this isActiveWindow() check and always sort the servers, but this is risky as the check was added for "performance cooperation" purpose. Sorting the server list is an expensive task and on 2010 PCs if you played the game and Doomseeker refreshed the servers in the background, you could actually feel the FPS drop. It's 10 years later now and with all the Ryzens around we could reconsider if this performance drop is still an issue, but I can say upfront that my stance here is cautious and that this behavior should not be changed.

Perhaps you could add a quick debug line to MainWindow::postInitAppStartup() and check what it says?

    qDebug() << "is active window:" << isActiveWindow();

If it says "false", then the sorting is disabled as intended and something is simply causing the window to not receive focus upon being launched.

(0021455)
WubTheCaptain   
2020-06-09 10:11   
(edited on: 2020-06-09 10:13)
Quote from Zalewa
If it says "false", then the sorting is disabled as intended and something is simply causing the window to not receive focus upon being launched.

It says "false" at every opportunity, even if it works as intended.
Something with i3 window manager is weird. If I have a window already opened in a workspace, opening Doomseeker (either from a terminal or dmenu) will gain focus. If there's no window open, Doomseeker won't get focus and then sorting won't happen without a click.
Because of above conditions, testing this makes it difficult too to get stdout/stderr output. I tried sleep 2; ./doomseeker but looks like switching workspaces to a workspace with no windows (to reproduce the issue of workspaces with no windows not gaining focus) in that time period also gives focus to Doomseeker.

(0021457)
Zalewa   
2020-06-09 13:14   
Quote from "Wub"
It says "false" at every opportunity, even if it works as intended.

That's also possible. The window may be "inactive" at the moment of the check and then becomes active some time later.
(0022386)
Zalewa   
2022-09-10 15:29   
(edited on: 2022-09-10 15:30)
Quote from WubTheCaptain
Because of another bug, the server filtering checkbox "put populated servers on top" shouldn't matter.

This is an actual bug but I don't see a dedicated ticket for it. Fixed it anyway:'https://bitbucket.org/Doomseeker/doomseeker/commits/b89dc70f0186465f5b46a8eb9f1ee9b89eb62367 [^]'

As for the rest of your report I fail to see anything that would indicate an incorrect behavior. The program won't sort the servers when its window is out of focus (inactive), regardless if you are able to see the window and scroll the server list within it. This is by design.

We could discuss if scrolling the list should trigger the sorting. My opinion is that the UX is screwed either way:

  • we trigger sort on scroll: you scroll the list and it shifts everything around, where did the servers you were just looking at go?

  • we keep it as it is: you click the program and it shifts everything around, where did the servers you were just looking at go?

  • we sort even if program is out of focus: choppy choppy system CPU usage spikes.


So, let's not screw around with this.