Repository: lutris/lutris

Issue:
“Restore default gamma....” doesn’t restore gamma after game quits
For some reason, with "Restore default gamma..." option enabled, default screen gamma is not restored after a game that changes it quits (even after Lutris kills processes in the prefix)
When running Lutris in debug mode (-d) I get this Warning:
"WARNING  2018-08-08 18:46:47,323 [display.restore_gamma:168]:xgamma is not available on your system"
Would be nice to fix this, as changing screen gamma back manually is a bit annoying.


Discussion:
If xgamma isn't installed I don't know how we can possibly restore gamma....

What would be more reasonable would be to gray out that option when xgamma isn't available
Oh I am sorry I was in a hurry and completely forgot to mention that I do have xgamma installed and it works if I run “xgamma -gamma 1”, which restores gamma to default.
If you have xgamma installed then lutris shouldn't be saying "xgamma is not available on your system"...
That’s the thing, it shouldn’t... but it does.
The distro I am using is Arch with XFCE running in Xorg and I got Lutris
from aur, but I get the same thing with lutris-next and I think I had this
same issue on Ubuntu using Xorg though I will have to install it in a VM
and test it to be sure.

On Wed, 8 Aug 2018 at 21:22, Mathieu Comandon <notifications@github.com>
wrote:

> If you have xgamma installed then lutris shouldn't be saying "xgamma is
> not available on your system"...
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/lutris/lutris/issues/1010#issuecomment-411504109>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AKHGPaICU_L6EInhhgGafiHOqvGl44Mpks5uOyxjgaJpZM4V0NQR>
> .
>

Oh also if you google “lutris xgamma not installer” there will be quite a few issues linked to this projects witht the same Warning message, though I can be certain those users have xgamma installed, but it’s very likely as pretty much all distros still have Xorg and Wayland adoption rates are still low.
I'm pretty sure most of those results are misdiagnosis of issues, when xgamma isn't installed, we don't run xgamma, that's it. It's not going to cause crashes or anything. It's like that winemenubuilder message, people are reading too much into it.
I wouldn’t have any issues with that message,  but when a game I play Sims
3 (it’s the only game I own that changes screen gamma in fullscreen mode, but I know an old game demo that does this too and can provide it for testing purposes) exits Lutris doesn’t restore the gamma to default, even if I stop the
processes in the prefix by pressing the stop button or letting it do that
by itself. I can’t be 100% sure that warning and xgamma restoration not working
are related but it’s just very likely.
Perhaps the way Lutris detects that xgamma is installed got borked by
whatever reasons?

On Wed, 8 Aug 2018 at 21:46, Mathieu Comandon <notifications@github.com>
wrote:

> I'm pretty sure most of those results are misdiagnosis of issues, when
> xgamma isn't installed, we don't run xgamma, that's it. It's not going to
> cause crashes or anything. It's like that winemenubuilder message, people
> are reading too much into it.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/lutris/lutris/issues/1010#issuecomment-411511481>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AKHGPY0kgm9n8Mnv4jgUkfeQK_PUG2Fpks5uOzHrgaJpZM4V0NQR>
> .
>

Oh and those issues I mentioned didn’t complain about the xgamma really, they just contained that warning.
I just had a quick look at this, and it happens on my Solus install as well despite xgamma being installed.
The code in display.py checks the variable XGAMMA_FOUND, which is plainly set to false at the very beginning of the script and never changed again. I don't see how this could work for anyone

Resolving patch:
diff --git a/lutris/util/display.py b/lutris/util/display.py
--- a/lutris/util/display.py
+++ b/lutris/util/display.py
@@ -12,8 +12,7 @@
 
 XRANDR_CACHE = None
 XRANDR_CACHE_SET_AT = None
-XGAMMA_FOUND = False
-
+XGAMMA_FOUND = None
 
 def cached(function):
     def wrapper():
@@ -161,7 +160,7 @@ def restore_gamma():
     """Restores gamma to a normal level."""
     global XGAMMA_FOUND
     if XGAMMA_FOUND is None:
-        XGAMMA_FOUND = system.find_executable('xgamma')
+        XGAMMA_FOUND = bool(system.find_executable('xgamma'))
     if XGAMMA_FOUND is True:
         subprocess.Popen(["xgamma", "-gamma", "1.0"])
     else:


Test patch: