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
X11 windows cannot be shared in browsers (Firefox, Chromium) #4924
Comments
Fixed, thanks! |
Thanks, @slouken! This should fix an issue I'm seeing with @openbsd's That said, does your fix in 6c56e27 reintroduce old issues (at least in older window managers that don't support |
Could you provide a PR with a tested patch? I don't have a test environment for this right now. |
Yes, I removed |
Is this something you guys can fix for 2.0.18? I'd like to ship without this regression, if possible. |
@slouken I don't have much availability to work on this except for this coming weekend (2021-11-27 & 28). I see 2.0.18 is already a few days overdue, so I'm not sure if that's soon enough or if there's enough else pending that it'd be okay. |
There's enough pending that this weekend would be fine. Thanks! |
What happened to this one? Still meant for 2.0.18? |
Yes, morgant is going to get this tested and in for 2.0.18. |
@morgant, this is the last item going into 2.0.18. Do you have something ready for tomorrow? |
@slouken I'm not a regular SDL contributor and the patch under discussion is the only one I've ever written. I have available time going for me, but maybe my lack of experience might make you weary of having me try to fix it. Also, you might be able to rightly say I shouldn't fix the mess I made, although I'd say that reliance on |
I'm looking at the code a little harder and I actually think that the "quick and dirty" patch is really close to being the right one. The previous code only existed to try to run Xorg under a non-Unicode locale. I would say that running Xorg that way is extremely rare these days, probably even non-existent, and likely to cause other issues, but I think I can write a patch pretty quickly here given we know 99% of the problem, I just need to verify some things about Xorg, locales, and whether we should be using |
Sure, go for it. Can you coordinate with @morgant? |
Will do, working on it now. |
…_WM_NAME (UTF-8) for window name/title. Issue libsdl-org#4924 & libsdl-org#4979
@slouken & @ctrlcctrlv, my apologies for missing your replies yesterday. I have been working on a patch (morgant@b9b5c04). I'm still testing as I'm also not a regular SDL contributor. As for the reliance on With the aforementioned string encodings in mind, I believe the cause of issue #4288 was that Also, I believe this same fix needs to be applied to |
I'm sorry, I have some thoughts on your patch based on my research. Firstly, it is wrong to say that WM_NAME should be ASCII. Actually, it should be in the server's locale, and Xorg supplies functions for this. Please see proof at https://tronche.com/gui/x/icccm/sec-2.html#s-2.7.1 , which mentions that the modern encoding for it is COMPOUND_TEXT.
Also, I think you should consider using the convenience function |
Also, research showed we're/I'm not the first to assume WM_NAME can finally be done away with, apparently the Qt project assumed the same in 2014 😆 https://herbstluftwm.org/archive/msg00459.html |
@ctrlcctrlv Thanks for the feedback! Yes, you're correct that I should be using a TextProperty so that it's correctly encoded as STRING, COMPOUND_TEXT (an implementation of ISO-2022, as I understand it), or C_STRING (for ASCII), based on the locale instead of forcing it to ASCII. I'm updating my implementation & testing now (sorry, my dev machine is a bit slow). As for assuming I do agree that the lack of |
Heh, here I am removing it everywhere, maybe I should stop. I rewound an old repository to 2010 to make absolute sure I was using XmbTextListToTextProperty correctly: exg/rxvt-unicode@d7d9875 just because I saw the CHANGELOG in Google 😆 I'm sorry I messed up the release cycle of such an important project so I'm doing my best to make sure whatever comes next will be as close to perfect as is possible |
Although in retrospect after writing that I think that a lot of the problems in this codebase are from people trying to maintain consistency with the existing implementation instead of changing what needs to be changed. I just saw |
Closes libsdl-org#4924. Based on patches of the past, such as this work by James Cloos in July 2010: exg/rxvt-unicode@d7d9875, as well as code comments in the Perl module X11::Protocol::WM (https://metacpan.org/pod/X11::Protocol::WM) and even the code to Xlib itself, which taught me that we should never have been using `XStoreName`, all it does is call `XChangeProperty`, hardcoded to `XA_STRING`! What can I say, when the task is old school, the sources are too 😂
Ah, I see you beat me to pretty much the same solution while I was futzing with testing, though you also addressed |
I believe I did all the testing I can think of (ran my original example inside |
I'd be curious what |
Closes #4924. Based on patches of the past, such as this work by James Cloos in July 2010: exg/rxvt-unicode@d7d9875, as well as code comments in the Perl module X11::Protocol::WM (https://metacpan.org/pod/X11::Protocol::WM) and even the code to Xlib itself, which taught me that we should never have been using `XStoreName`, all it does is call `XChangeProperty`, hardcoded to `XA_STRING`! What can I say, when the task is old school, the sources are too 😂
This fixes a compile warning — and possible invalid memory read — introduced in 9c03d25 ("Add back X11 legacy WM_NAME encodings"), which was part of PR libsdl-org#5029, fixing Bug libsdl-org#4924. The issue is with one of the added warnings in X11_GetWindowTitle(). Basically, the "title" variable passed to SDL_LogError() hasn't been initialised yet: we could pass propdata in directly, but it's better to move the SDL_LogError() call until after title is set, IMHO. This fixes the following warning from gcc (SUSE Linux) 11.2.1: In file included from /home/david/Development/SDL/src/video/x11/../../SDL_internal.h:45, from /home/david/Development/SDL/src/video/x11/SDL_x11window.c:21: /home/david/Development/SDL/src/video/x11/SDL_x11window.c: In function 'X11_GetWindowTitle': /home/david/Development/SDL/src/video/x11/../../dynapi/SDL_dynapi_overrides.h:33:22: warning: '%s' directive argument is null [-Wformat-overflow=] 33 | #define SDL_LogDebug SDL_LogDebug_REAL /home/david/Development/SDL/src/video/x11/SDL_x11window.c:720:13: note: in expansion of macro 'SDL_LogDebug' 720 | SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to convert WM_NAME title expecting UTF8! Title: %s", title); | ^~~~~~~~~~~~
This fixes a compile warning — and possible invalid memory read — introduced in 9c03d25 ("Add back X11 legacy WM_NAME encodings"), which was part of PR #5029, fixing Bug #4924. The issue is with one of the added warnings in X11_GetWindowTitle(). Basically, the "title" variable passed to SDL_LogError() hasn't been initialised yet: we could pass propdata in directly, but it's better to move the SDL_LogError() call until after title is set, IMHO. This fixes the following warning from gcc (SUSE Linux) 11.2.1: In file included from /home/david/Development/SDL/src/video/x11/../../SDL_internal.h:45, from /home/david/Development/SDL/src/video/x11/SDL_x11window.c:21: /home/david/Development/SDL/src/video/x11/SDL_x11window.c: In function 'X11_GetWindowTitle': /home/david/Development/SDL/src/video/x11/../../dynapi/SDL_dynapi_overrides.h:33:22: warning: '%s' directive argument is null [-Wformat-overflow=] 33 | #define SDL_LogDebug SDL_LogDebug_REAL /home/david/Development/SDL/src/video/x11/SDL_x11window.c:720:13: note: in expansion of macro 'SDL_LogDebug' 720 | SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to convert WM_NAME title expecting UTF8! Title: %s", title); | ^~~~~~~~~~~~
X11 Windows created using SDL_CreateWindow cannot be shared in browser (see also Genymobile/scrcpy#2640).
The bug has been introduced in b3b4677.
Apparently, both _NET_WM_NAME and WM_NAME need to be set in order for the browser to find the window.
The following (quick and dirty) patch will fix this behaviour:
Moreover, using xdotool to rename (and set both properties of) a window can be used to work around this issue:
The text was updated successfully, but these errors were encountered: