lem-project / lem

Common Lisp editor/IDE with high expansibility
http://lem-project.github.io/
MIT License
2.4k stars 178 forks source link

Failed to set the `window opacity` in `sdl2` lem version. #1608

Closed sakurawald closed 4 days ago

sakurawald commented 6 days ago

The sdl2 lem editor failed to set window opacity. My ~/.lem/init.lisp file contains:

(sdl2-ffi.functions:sdl-set-window-opacity (lem-sdl2/display::display-window lem-sdl2/display::*display*) (coerce 0.9 'single-float))

This is a screen-shot about my alacritty terminal program, it's configured to display opacity window.

image

An interesting obervation is that, once i launch the lem editor, the window opacity of alacritty becomes invalid.

This also happens to some other video-ralted programs, like some video-games. I guess this is something about the sdl2 lib.

sakurawald commented 6 days ago

This is a screen-shot of lem editor. You can see the window opacity doesn't work. image

vindarel commented 5 days ago

"it works for me"© (LinuxMint)

your observations are interesting.

sakurawald commented 4 days ago

The eval result is always zero.

CL-USER>  (sdl2-ffi.functions:sdl-set-window-opacity (lem-sdl2/display:display-window lem-sdl2/display::*display*) 0.75)
0
sakurawald commented 4 days ago

"it works for me"© (LinuxMint)

your observations are interesting.

Yeah, it's much more interesting that, if i open the lem editor, then it makes:

  1. The window opacity of alacritty will be invalid.
  2. All window effects provided by kwin will be invalid. (I mean, the window effects like Window Management - Desktop Effects - Wobbly Windows.)

It seems like the window management is changed after the lem editor is launched. And this also happens to some other video-related programs, not just the lem editor.

However, i don't know why the window opacity function of alacritty works well, maybe alacritty implements the window opacity function in another different way.

sakurawald commented 4 days ago

I think this is an issue about the compatibility between sdl2 and kwin.

My situation is highly similar to this: https://kde-bugs-dist.kde.narkive.com/ti0RQpQv/kwin-bug-371480-new-sdl2-apps-causing-desktop-effects-to-disappear-task-manager-function-weirdly

After launch a sdl2 program:

  1. The color of my taskbar becomes different. (It's darker)
  2. The window effects provided by kwin compositor is invalid.
sakurawald commented 4 days ago

I found the solution: adding the custom window rule to set `blocking compositor

Martin Gräßlin via KDE Bugzilla8 years ago
[Permalink](https://narkive.com/ti0RQpQv.2)https://bugs.kde.org/show_bug.cgi?id=371480

Martin Gräßlin <***@kde.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |WORKSFORME

--- Comment #1 from Martin Gräßlin <***@kde.org> ---
This is expected behavior. SDL sets a hint to disable the compositor for better
performance and KWin honors this. With Plasma 5.8 we introduced a GUI config
option where you can disable this behavior in general.

With Plasma 5.7 you can already create a window specific rule to disallow
"Block Compositing". Create a rule for the window and select "Force" "No". That
will ensure that the compositing does not get disabled.