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

Merged
merged 6 commits into from
Oct 6, 2024
Merged

desktop: Add gamemode support #17940

merged 6 commits into from
Oct 6, 2024

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
Cargo.lock Show resolved Hide resolved
@kjarosh kjarosh added the waiting-on-review Waiting on review from a Ruffle team member label Oct 6, 2024
@Dinnerbone Dinnerbone merged commit 0d0c24a into ruffle-rs:master Oct 6, 2024
17 checks passed
@kjarosh kjarosh removed the waiting-on-review Waiting on review from a Ruffle team member label Oct 6, 2024
@kjarosh kjarosh deleted the gamemode branch October 6, 2024 21:35
};

if cfg!(not(target_os = "linux")) && gamemode_enable {
tracing::warn!("Cannot enable GameMode, as it is supported only on Linux");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that I look at it, this ends up adding a pointless warning on windows by default :(

Copy link
Member Author

Choose a reason for hiding this comment

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

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 newsworthy 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
5 participants