Skip to content
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

desktop: Add gamemode support #17940

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Sep 15, 2024

Fixes #17895.

This PR adds gamemode support through ashpd (Linux-only).

  • There are 3 values for the gamemode setting:
    • Off—gamemode is disabled,
    • On—gamemode is enabled,
    • Default—gamemode is enabled only on high power preference.
  • A CLI option --gamemode is added.
  • A GUI is added to the preferences.

Gamemode is requested only when a SWF file is loaded.

TODO:

@kjarosh kjarosh added A-desktop Area: Desktop Application linux T-feature Type: New Feature (that Flash doesn't have) labels Sep 15, 2024
@torokati44
Copy link
Member

torokati44 commented Sep 16, 2024

Bah, deny.toml also has to be updated to allow the new git source explicitly... Sorry for the added trouble!

Also, just curious, what made you go with ashpd over zbus directly? I assume the readily available (even if buggy) high level support for this specific use case - in which case, great!

But technically, ashpd, outside of a Flatpak jail, just does a DBus call or two; and zbus also works over Flatpak, right?

@kjarosh
Copy link
Member Author

kjarosh commented Sep 16, 2024

just curious, what made you go with ashpd over zbus directly? I assume the readily available (even if buggy) high level support for this specific use case - in which case, great!

That's true.

But technically, ashpd, outside of a Flatpak jail, just does a DBus call or two: and zbus also works over Flatpak, right?

That's also true.

I could go with zbus and write the proxy myself, but we depend on ashpd anyway (through rfd) and using ashpd we don't have to worry about D-Bus names and types, which is a value added.

However, if we have good reasons to stick with zbus, I can also switch to it.

(I'm also considering rewriting our FreedesktopSettings to use ashpd for the same reasons.)

@torokati44
Copy link
Member

However, if we have good reasons to stick with zbus, I can also switch to it.

No, quite the opposite, in agreement with you. I was just checking my assumptions.

@Dinnerbone
Copy link
Contributor

CI only lints on linux so I'll pretend to be a bot for a moment.

warning: field `gamemode_preference_readonly` is never read
  --> desktop\src\gui\dialogs\preferences_dialog.rs:24:5
   |
11 | pub struct PreferencesDialog {
   |            ----------------- field in this struct
...
24 |     gamemode_preference_readonly: bool,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: method `show_gamemode_preferences` is never used
   --> desktop\src\gui\dialogs\preferences_dialog.rs:304:8
    |
52  | impl PreferencesDialog {
    | ---------------------- method in this implementation
...
304 |     fn show_gamemode_preferences(
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `gamemode_preference_name` is never used
   --> desktop\src\gui\dialogs\preferences_dialog.rs:556:4
    |
556 | fn gamemode_preference_name(
    |    ^^^^^^^^^^^^^^^^^^^^^^^^

@kjarosh
Copy link
Member Author

kjarosh commented Sep 17, 2024

Dinnerbot? 👀

@kjarosh kjarosh force-pushed the gamemode branch 2 times, most recently from bc541b2 to 7f1f8ab Compare September 18, 2024 09:14
@kjarosh kjarosh marked this pull request as ready for review September 18, 2024 09:29
Comment on lines +249 to +264
[[package]]
name = "ashpd"
version = "0.9.0"
source = "git+https://github.com/bilelmoussaoui/ashpd.git?rev=34c0ab8f83cd16c3190ecc4cc51021daa531d89b#34c0ab8f83cd16c3190ecc4cc51021daa531d89b"
dependencies = [
"enumflags2",
"futures-channel",
"futures-util",
"rand",
"serde",
"serde_repr",
"tokio",
"url",
"zbus",
]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe [patch.crates-io], so it doesn't get duplicated?
I suppose it's not a big deal, and that would be just one more piece of debris to clean up afterward...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we could just wait a few days...: bilelmoussaoui/ashpd#234 (comment) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-desktop Area: Desktop Application linux T-feature Type: New Feature (that Flash doesn't have)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to request GameMode on Linux
3 participants