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

Support additional gamescope options #3476

Merged
merged 5 commits into from
Mar 31, 2024
Merged

Conversation

Etaash-mathamsetty
Copy link
Member

@Etaash-mathamsetty Etaash-mathamsetty commented Jan 28, 2024

Funny story behind this PR: I was trying to play some random Styx game from GOG that had broken mouse capture on kwin wayland, I opened it through gamescope, it works but on the wrong monitor this time, then I wrote the code for this PR really quickly to change the displays, and guess what ... gamescope doesn't support changing the displays. I will have to make a PR there as well

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@Etaash-mathamsetty Etaash-mathamsetty force-pushed the gamescope-additional-opts branch from 0b0148f to f08d2b7 Compare January 28, 2024 02:43
@Etaash-mathamsetty
Copy link
Member Author

Etaash-mathamsetty commented Jan 28, 2024

this generates a lot of log spam when changing the additional options thingy, I think there should be a way to fix this though

@Etaash-mathamsetty Etaash-mathamsetty added the pr:ready-for-review Feature-complete, ready for the grind! :P label Jan 29, 2024
Copy link
Member

@imLinguin imLinguin left a comment

Choose a reason for hiding this comment

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

LGTM

@Etaash-mathamsetty Etaash-mathamsetty force-pushed the gamescope-additional-opts branch from fc2f2c7 to 99a7b0d Compare February 4, 2024 05:48
@flavioislima flavioislima modified the milestone: 2.13.0 Feb 4, 2024
@flavioislima
Copy link
Member

I believe that would be good to also add the HDR option.
And when enabled, add the DXVK_HDR=1 to the env variables.
this is how it works on my machine.

@Etaash-mathamsetty
Copy link
Member Author

i think on change is the best option since otherwise you need to have a onChange and an onBlur

@Etaash-mathamsetty Etaash-mathamsetty force-pushed the gamescope-additional-opts branch 2 times, most recently from fe42318 to 386b2bc Compare February 4, 2024 18:32
@imLinguin
Copy link
Member

onBlur didn't work because you were relying on the value from useSetting it didn't change because you couldn't input anything in the first place due to lack of meaningful onChange. To implement this properly you need to add separate state for holding input value, then update useSetting value onBlur

@imLinguin
Copy link
Member

That would look like this

   const [fetching, setFetching] = useState(true)
   const [isInstalled, setIsInstalled] = useState(false)
 
+  const [additionalOptions, setAdditionalOptions] = useState(gamescope.additionalOptions)
+
   useEffect(() => {
     setFetching(true)
     window.api
@@ -358,7 +360,7 @@ const Gamescope = () => {
         label={t('options.gamescope.additionalOptions', 'Additional Options')}
         htmlId="additionalOptions"
         placeholder=""
-        value={gamescope.additionalOptions}
+        value={additionalOptions}
         afterInput={
           <FontAwesomeIcon
             className="helpIcon"
@@ -369,7 +371,8 @@ const Gamescope = () => {
             )}
           />
         }
-        onChange={(event: ChangeEvent<HTMLInputElement>) =>
+        onChange={(event: ChangeEvent<HTMLInputElement>) => setAdditionalOptions(event.currentTarget.value)}
+        onBlur={(event: ChangeEvent<HTMLInputElement>) =>
           setGamescope({
             ...gamescope,
             additionalOptions: event.currentTarget.value

I imagine while we are at it we could do the same thing for other input fields in this component

@Etaash-mathamsetty
Copy link
Member Author

onBlur didn't work because you were relying on the value from useSetting it didn't change because you couldn't input anything in the first place due to lack of meaningful onChange. To implement this properly you need to add separate state for holding input value, then update useSetting value onBlur

yeah I was trying to fix this, but I just didn't connect it with useState lol
I was using a regular old variable

@Etaash-mathamsetty Etaash-mathamsetty force-pushed the gamescope-additional-opts branch from 386b2bc to ad21e79 Compare February 6, 2024 23:23
Copy link
Member

@flavioislima flavioislima left a comment

Choose a reason for hiding this comment

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

lgtm

@flavioislima flavioislima merged commit 4c07157 into main Mar 31, 2024
@flavioislima flavioislima deleted the gamescope-additional-opts branch March 31, 2024 21:21
@Heroic-Games-Launcher Heroic-Games-Launcher locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants