Open martinmcclure opened 3 years ago
Same here with Kubuntu 20.04
Hi guys! This issue has been annoying me since I moved to Pharo 9, today I decided to do something about it. I don't know if this is the best solution, but I've added the hint you mention to the SDLNullPlatform
class and it worked. I also had to remove the SDL library bundled with the VM, as it is an older version that doesn't support the hint.
I know it's probably a half-baked solution, and I haven't read about the proper contribution process, so I'll just add the patch here in case anyone needs it. It's pretty short, so I guess it's ok.
A quick note: If I use 2
as a value it doesn't work, with 0
is working.
diff --git a/src/OSWindow-SDL2/SDL2ConstantsHint.class.st b/src/OSWindow-SDL2/SDL2ConstantsHint.class.st
index ee785d3a05..8482f46343 100644
--- a/src/OSWindow-SDL2/SDL2ConstantsHint.class.st
+++ b/src/OSWindow-SDL2/SDL2ConstantsHint.class.st
@@ -53,6 +53,7 @@ Class {
'SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS',
'SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT',
'SDL_HINT_VIDEO_WIN_D3DCOMPILER',
+ 'SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR',
'SDL_HINT_VIDEO_X11_NET_WM_PING',
'SDL_HINT_VIDEO_X11_XINERAMA',
'SDL_HINT_VIDEO_X11_XRANDR',
@@ -136,4 +137,5 @@ SDL2ConstantsHint class >> initialize [
SDL_HINT_OPENGL_ES_DRIVER := 'SDL_OPENGL_ES_DRIVER'.
SDL_HINT_AUDIO_RESAMPLING_MODE := 'SDL_AUDIO_RESAMPLING_MODE'.
SDL_HINT_AUDIO_CATEGORY := 'SDL_AUDIO_CATEGORY'.
+ SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR := 'SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR'.
]
diff --git a/src/OSWindow-SDL2/SDLNullPlatform.class.st b/src/OSWindow-SDL2/SDLNullPlatform.class.st
index 820ea4caae..b4d90ebe5d 100644
--- a/src/OSWindow-SDL2/SDLNullPlatform.class.st
+++ b/src/OSWindow-SDL2/SDLNullPlatform.class.st
@@ -17,5 +17,6 @@ SDLNullPlatform >> initPlatformSpecific [
"For windows and Unix, we activate linearization.
This does not work properly on OSX with retina display, blurrying the rendering"
- SDL2 setHint: SDL_HINT_RENDER_SCALE_QUALITY value: '1'
+ SDL2 setHint: SDL_HINT_RENDER_SCALE_QUALITY value: '1'.
+ SDL2 setHint: SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR value: '0'.
]
I guess NullPlatform
is not very descriptive, but I've found that Mac OS and Windows have their own classes. Maybe an X11 platform is needed, or a unix one... I don't know, just saying.
@ezeaguerre Great to see someone pick this up and find where to put the change! Hopefully @tesonep will get a chance to review your contribution soon.
Thanks a lot @ezeaguerre. Our plates are really full so any help is welcome.
Hey guys! I'm glad to help! Tell me if you need anything else, maybe that I send this patch in a different form (maybe a fork + a PR request or something like that). Being this short I guess it's ok. Anyway, I'm glad to help!
Describe the bug SDL, by default, requests that the window manager disable compositing. This is intended to increase the performance of full-screen games. However, it has a serious impact on some window managers (such as kwin) where it affects all windows. Pharo itself also has some problems with its display when compositing is disabled -- Pharo does not appear to know when it needs to refresh its display after being brought to the front, or when switching desktops, so the Pharo window continues to display whatever the screen's contents were, until you click in the Pharo window.
To Reproduce Launch a recent Pharo 9 build under the headless VM on a KDE Linux. Window compositing disappears, making it hard to see where one window ends and the next begins. Quit Pharo, and compositing returns.
Expected behavior Pharo leaves other windows alone.
Screenshots Pharo not running:![image](https://user-images.githubusercontent.com/2240523/103469344-38a7b180-4d18-11eb-838d-c1211446808a.png)
With Pharo running:![image](https://user-images.githubusercontent.com/2240523/103469323-14e46b80-4d18-11eb-8cfa-e3739c2734fc.png)
Pharo as the top window, but not yet clicked on. Only the window header shows, but it does obscure other windows:![image](https://user-images.githubusercontent.com/2240523/103469491-74437b00-4d1a-11eb-93ad-2196e9f99167.png)
After clicking in the Pharo window:![image](https://user-images.githubusercontent.com/2240523/103469504-96d59400-4d1a-11eb-92bd-7401cf4b6ffd.png)
Version information:
Expected development cost Not much? Starting with SDL 2.0.8, SDL provides SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, which defaults to 1. If set to 2 it should prevent this. See https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm45075509052384
Additional context There is a workaround, at least in KDE/Plasma. System Settings / Display and Monitor / Compositor contains an item "Allow applications to block compositing." This is on by default. When turned off, Pharo works better. But it would be considerably better for Pharo to not try to block compositing in the first place.