-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose registered games on the bus #155
Conversation
First step to making GameModeClient useful outside of gamemode- context.c.
This is so it can out-live its membership in the client list, e.g. when it is passed outside of gamemode-context.c and the reaper comes along and reaps a client in the background but we still are using the struct outside.
So it can be used outside ouf gamemode-context.c.
Now that GameModeClient is reference counted, the counterpart to game_mode_client_unref is also needed.
Add getters for all two properties of GameModeCLient: the process id and the executable path.
Return an array of pid_t elements containing the process ids of all registered clients. Memory ownership is transferred to the client and must be freed.
Like game_mode_context_has_client, but will add a reference to the client, if a match was found.
Just realized I have some inconsistencies between pids on the bus as unsigned |
For each registered game, export an object on the bus under the path "/com/feralinteractive/GameMode/Games/<pid>" with an dbus interface of ""com.feralinteractive.GameMode.Game". The interface currently provides to properties, ProcessId and Executable. Additionally add the ListGames method and the GameRegistered, GameUnregistered signals to the com.feralinteractive.GameMode interface.
Every time a game is (un)-registered and we emit the corresponding signal, also emit the properties change signal for ClientCount.
All looks good to me, merged. Thanks! I did one follow up change (12cf304) just to reduce some duplication of the game path prefix string. |
Thanks! The follow-up change makes total sense. Btw, any plans for a 1.4 release? ;) |
Don't have any specific plans for a new release currently, but since there's a reasonable amount of new stuff I'll see if we can do one soon. |
For the Shell extension (or a little separate tool) as well as future integration with GNOME Usage I wanted to get the list of currently registered games from gamemoded. For this I added to the
com.feralinteractive.GameMode
interface:As well as a new
com.feralinteractive.GameMode.Game
interface:This should make it possible for a client to track all currently registered games (start listening to the signals, list the current active ones and track changes via the signals).
In order to expose the individual games, I opted for expose the
GameModeClient
struct (as an opaque struct with getters). To be able to do this I added reference counting to it, so it can outlive being reaped by the reaper. Since the object is de-facto immutable this should be sufficient.