Page MenuHomeWildfire Games

Lobby auto away after inactive time or window is in background
Needs ReviewPublic

Authored by bb on Aug 14 2017, 8:04 PM.

Details

Reviewers
elexis
ffffffff
Trac Tickets
#4978
Summary

Should be configurable maybe in lobby as stated here or in options.

can be combined with hiding the profile panel when not needed D893.

Option for configuring auto away minutes.

Test Plan

Recompile as it inserts some cpp code for focus loosing window event.

Test the settings for different times and background event when window looses event. Just focus another window why keeping an eye on the away state in playerlist.

Consider the gamestup_mp presence changers and see that they still work as expected.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
ffffffff edited the summary of this revision. (Show Details)Dec 18 2017, 3:06 AM
ffffffff retitled this revision from Lobby auto away after time inactive (no event) or window in background to Lobby auto away after inactive time or window in backgrounded..Dec 22 2017, 11:57 PM
ffffffff retitled this revision from Lobby auto away after inactive time or window in backgrounded. to Lobby auto away after inactive time or window is in background.Dec 23 2017, 1:11 AM
ffffffff added a subscriber: mapkoc.
ffffffff added a subscriber: Hannibal_Barca.

Can you color the options (green, red and orange)?
I don't see how away in 5 is any useful.
Background away doesn't seem to work and mods can't use that.

ffffffff added a comment.EditedDec 23 2017, 1:19 AM

Ah this auto away time goes configurable in options. Needs patch there. It can be changed in user config at the moment manually of course. For background setting you need to recompile (goes fast as it compiles only changed files) as it inserts some cpp code.

Color is sadly at the moment not possible with dropdown. This would be really neat indeed. :)

ffffffff updated this revision to Diff 4925.Dec 24 2017, 1:23 AM
ffffffff edited the summary of this revision. (Show Details)
ffffffff edited the test plan for this revision. (Show Details)

Setting in options for setting auto away minutes.

Works as advertised.
Is it the best idea to remember last state when relogging to lobby?
Maybe start in Available every time you log?

ffffffff added a comment.EditedDec 24 2017, 12:49 PM

Yea. It's a good idea. Will save in some patch D210 also sorting order and column, for next relog into lobby, besides being able to sort by multiple columns ;). We should restore previous lobby presence option that's true, with setted auto away option this is good.

bb added inline comments.Dec 25 2017, 3:34 PM
binaries/data/config/default.cfg
509

Don't store the index here but a name
Presence mode in the lobby, default is available with auto away over time or background

binaries/data/mods/public/gui/lobby/lobby.js
10

either don't create these values her correctly, or don't create the keys and do it in init

11

should be a bool right?

11–13

Don't use onFoo for this, just foo will be enough

19

Don't use optional arguments when they aren't there

30

period

33

that is a recursive definition, make two objects: one for these functions and another for the current state (onBackground etc.). And a global variable for g_AutoAway.time

37

period

42

-when

46

jsdoc explaining the parameters pls

awayTimeInBackground => combineTimeBackground

50

-and

60–64

what is this supposed to do?

91

setAutoAway

108

Don't treat onTimeInBackground as a bool when it isn't (so either make it a bool, or treat it as a string)

binaries/data/mods/public/gui/options/options.json
622

Also make an option to change the default behaviour maybe?
(and change the default also when someone uses the lobby dropdown)

ffffffff updated this revision to Diff 4949.Dec 25 2017, 9:09 PM

bb

binaries/data/mods/public/gui/lobby/lobby.js
19

Don't see optional argument :(.

30

Maybe we want to get some short names here. But description is ok :).

108

bool now

binaries/data/mods/public/gui/options/options.json
622

Why changing the default. It's done via user.cfg. But presence option is safed to user.cfg. When should default behaviour applied? If user sets dropdown, it's resetted anyway to it when reenter lobby :). So we give as decisioned default "available_awaytimeorbackground".

ffffffff added inline comments.Dec 25 2017, 9:13 PM
binaries/data/mods/public/gui/lobby/lobby.js
33

i made now one object for state + timeMinutes from config : ( and one for name and description and "func" :) ?

46

The bool is now used to indicate away time in background so name is ok. When not set and both auto away time and background are true set it the previous "or" state so both events can trigger away event : ).

bb added inline comments.Dec 25 2017, 9:18 PM
binaries/data/mods/public/gui/lobby/lobby.js
19

setPlayerPresence is called below with more arguments, put them here too, same for the some calls below

108

line 97 gives the value as "and", but here you treat is as a bool, so either make it a bool, or treat is as a string

binaries/data/mods/public/gui/options/options.json
622

Oh it already puts the value in user.cfg? that part is ok then

Was more talking about adding the same dropdown in the options window too.

bb added inline comments.Dec 25 2017, 9:24 PM
binaries/data/mods/public/gui/lobby/lobby.js
33

looks like ok

46

still jsdocs
(also make it a bool when called)

ffffffff updated the Trac tickets for this revision.Jan 18 2018, 7:12 AM
ffffffff updated this revision to Diff 5382.Jan 19 2018, 4:22 AM

New g_GUI->SendEventToAll("WindowFocus"); C++ implementation.
Easier code.

ffffffff added inline comments.Jan 20 2018, 1:23 AM
binaries/data/mods/public/gui/lobby/lobby.js
82

if (ev.type == "mousemotion" || !g_WindowFocus)

bb added a comment.Jan 30 2018, 12:21 AM

Comments from last time I looked (probably some are fixed)

binaries/data/config/default.cfg
513

that thing in between braces can be removed

binaries/data/mods/public/gui/lobby/lobby.js
24

why is that a function returning an array containing objects, and not just an array containing objects

28

imo, don't use the optionality of the arguments , but just pass them

41

could be set in the head right?

52–54

-ean

64

-on variable
-spam
s/hits/ends

70

presence change sounds like the current state of the player (active/busy/away) not the value of the dropdown

71

store it and apply after time

75

delete g_Presence.timer ? (and then also not set it in the head)

76

500 magical value => head

ffffffff planned changes to this revision.EditedJan 30 2018, 4:12 AM

Busy presence rid off from dropdown (cause no gamelist updates in that presence sadful, but im not sure this still needs to be connected with the presence. Maybe one could change the no gamelist updates to an not in lobby variable that one set in engine instead. So we can be busy presence in lobby while we receive gamelist updates while we are in lobby. Maybe @elexis can help here? )
bb comments

ffffffff updated this revision to Diff 5738.Feb 9 2018, 1:21 PM
ffffffff added inline comments.Feb 10 2018, 3:06 PM
binaries/data/mods/public/gui/lobby/lobby.js
47

saveAndWriteToUserConfig(..)

52

s/500ms/g_Presence.timeoutMilliSeconds/g

66

When in timeout, store presence for apply after it.

73

Start timeout

bb requested changes to this revision.Mar 19 2018, 10:48 PM

Patch looks almost done, will get in shortly after the release I guess (string freeze and stuff blocks me from committing)

binaries/data/mods/public/gui/lobby/lobby.js
26

My bad, actually this is wrong, since the value can change while in the lobby (when having a button to the options window), so we shouldn't store this but call the engine every time we need it.

36

remove

37

Initialize...

39

why not put above updateConnectedState?

52

nuke

55–57

remove Optional (and replace caps as appropriate)

66

When is timeout, store presence to apply it when the timer runs out

73

nuke

91–95

why do we need that timeout?

binaries/data/mods/public/gui/lobby/lobby_panels.xml
48 ↗(On Diff #5738)

nuke

52 ↗(On Diff #5738)

was thinking if checkboxes wouldn't be better, but meh no space

binaries/data/mods/public/gui/options/options.json
555

make it a slider

559

why no 0?

622

shouldn't presenceSelection also get an option?

source/ps/Globals.cpp
57–63 ↗(On Diff #5738)

WindowGainedFocus/WindowLostFocus would be better imo

This revision now requires changes to proceed.Mar 19 2018, 10:48 PM
bb commandeered this revision.Jul 28 2023, 6:40 PM
bb edited reviewers, added: ffffffff; removed: bb.
This revision now requires review to proceed.Jul 28 2023, 6:40 PM
bb updated this revision to Diff 22106.Jul 28 2023, 6:43 PM
bb edited the summary of this revision. (Show Details)
bb edited the test plan for this revision. (Show Details)

Rewrite of the patch in OOP. Full option toggleable. No more dropdown as that costs gui space and we already have chat commands.

Owners added a subscriber: Restricted Owners Package.Jul 28 2023, 6:43 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8276/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7187/display/redirect

Successful build - Chance fights ever on the side of the prudent.

builderr-release-gcc7.txt
In member function 'void CInput::UpdateText(int, int, int)':
cc1plus: warning: 'void* __builtin_memset(void*, int, long unsigned int)': specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/8858/display/redirect