Systray should support transparency on 32-bit Emacs (Was: No systray with emacs v29.0.50)
danrobi11 opened this issue · 30 comments
I compiled v29.0.50 today and the exwm systray is not working. Was working fine with 27.1
See https://lists.gnu.org/archive/html/emacs-devel/2022-02/msg00104.html for context.
@Stebalien Hi. Thank's for the support. It works but the tray is now top left corner :/ Its better than nothing tho.
Hm. Odd. It's in the bottom-right corner on my machine
@Stebalien Ya its weird. Not a deal breaker tho so I might try to debug that later on. I'll close the issue for now. Thank's again for the support, much appreciated.
I'd reopen it. This is just a workaround, the bug is still there.
I'd reopen it. This is just a workaround, the bug is still there
Ok
@danrobi11, thank you for reporting this issue.
I've linked a similar report by @jaor on #858.
I think the issue is either with exwm--color->pixel
or the combination of the systray being reparented on the Emacs' frame X window (https://github.com/ch11ng/exwm/blob/master/exwm-systemtray.el#L367), the background-pixmap
being set to ParentRelative
(https://github.com/ch11ng/exwm/blob/master/exwm-systemtray.el#L512) and that both X windows have different visuals.
@Stebalien, I appreciate your help in the issue tracker and elsewhere.
i've been trying to fix the problem by assigning a correct visual to
the systray embedder without success, so i must be missing something
(unsurprisingly, since i don't know much about xcb, i'm afraid). as
an observation, what seems to be going on with the current code plus
the transparency for workspaces patch (which is working like a charm
for me, btw) is that when a new icon pops up and the embedder tries to
reparent it (that callback gets effectively called), the icon ends up
as a workspace (or root) child (my guess is that the reparenting
simply fails, but i haven't been able to make it work).
for reference jaor@dfd2b4d is my latest failed attempt at fixing the systemtray problem by adjusting visuals and the like (mimicking what's being doing in exwm-workspace).
Please test proposed fix: #867.
Thank you for accepting. I'll note it down in the Wiki.
a little detail, though: while the systray is there and takes icons just
fine, it's not exactly respecting the set alpha-background... it's a bit
difficult to tell, but i'd say the first icon added to the tray has an
opaque background, while subsequent ones get the correct alpha.
Hmm, you are right.
What was the previous behaviour, though? As far as I can see, it seems to inherit the frame's background; there was no transparency. This is what I see on Emacs 27 and EXWM without #867:
Previous code used a xcb:BackPixmap:ParentRelative
:background-pixmap
, where the parent was the Emacs frame [1]. https://x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:CreateWindow says:
If background ParentRelative is specified, the parent's background is used, but the window must have the same depth as the parent (or a Match error results)
#867 changes the embedder window to use the root window's depth and visual, but the parent is the Emacs' frame with the 32bit depth, so we can no longer use ParentRelative
, and use None
instead.
If the background is None, the previous screen contents from other windows of the same depth as the window are simply left in place if the contents come from the parent of the window or an inferior of the parent; otherwise, the initial contents of the exposed regions are undefined.
I guess we are seen the contents become "undefined".
I'm not sure what the right fix is. We can create the embedder window with 32bit depth, but the spec says that we must be prepared to support icons in other depths. And that we "must use the Composite extension to composite the icon against the background". See https://specifications.freedesktop.org/systemtray-spec/systemtray-spec-latest.html#visuals and https://specifications.freedesktop.org/systemtray-spec/systemtray-spec-latest.html#idm45080845287296. I don't have de bandwidth to do that. (Would you be interested in trying?)
Meanwhile, please test the new commit in #867, which creates a 32bit embedder window, and let me know how it works for you.
[1]: Though, if I understand correctly, xcb:BackPixmap:None
was effectively used unless customized, as no xcb:CW:BackPixmap
was included in :value-mask
; see https://github.com/ch11ng/exwm/pull/867/files#diff-fb276d4e1c34c3538814bf2e1f91532cbbf064326920d214655c6252b2d83316R514. Unless the :set
form of the exwm-systemtray-background-color
defcustom ran inconditionally.
It's working well for me as well.
@Stebalien: the issue with nm-applet seems to be the following:
- when it starts it does not know that EXWM will make a fancy 32-bit depth systray, so it makes a regular systray icon. EXWM's 32-bit systray (as in #867) does not support those.
- I don't know. It's possible that the systray agent is not restarted?
When starting it after EXWM is up, nm-applet notices that we support 32-bit and makes such an icon.
I decided I'll disable systray transparency when using 32-bit depth emacs, reason in #867. This ticket will be turned into a feature request. Opinions?
when it starts it does not know that EXWM will make a fancy 32-bit depth systray, so it makes a regular systray icon.
Makes sense, although I'm still confused why restarting nm-applet doesn't fix it (I'm definitely restarting it).
I decided I'll disable systray transparency when using 32-bit depth emacs, reason in #867. This ticket will be turned into a feature request. Opinions?
That seems reasonable for most EXWM users. It also reduces the need for #879.
So, reverting that commit works but only if a background color is explicitly set with exwm-systemtray-background-color
. We'd probably want a theme hook to set the background color when the theme background is toggled.
If it isn't set, the "background" defaults to "whatever was drawn before", so any changing/animated icon quickly becomes a mess.
@danrobi11, @Stebalien, @jaor: please test the latest version: #867 (comment).
when it starts it does not know that EXWM will make a fancy 32-bit depth systray, so it makes a regular systray icon.
Makes sense, although I'm still confused why restarting nm-applet doesn't fix it (I'm definitely restarting it).
I don't know either...
@jaor: please test again the latest version of #867. I solved the initialization issue by setting the default to 'workspace-background, as it's supported by all configuration. I have to say that I think, though am not sure, that there is no difference between 'transparent and 'workspace-background in 24-bit configurations: 'transparent makes the systemtray use the same background-pixmap as Emacs' frames; I'd guess that the background pixmap is exactly the frame background color. In your experience, did 'transparent offer actual transparency?
But of course, the tray doesn't work at all with 32bit depth. I understand this is deliberate, so well, that's it (as mentioned, it doesn't solve the issue for me, because i want alpha-background, but that's just me).
Do I understand correctly that you'd like the systemtray to be 32-bit and support alpha-background?
0.27 has been released, which includes the fixes in #867. Transparency is not supported in 32-bit visual Emacs.