mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-28 08:08:44 -05:00
There are two situations where xcomposite window capture will capture random windows: on first creation, and when going to the properties when the current window is invalid. The first happens because for whatever reason someone decided to just make it capture the first top-level window if there is no set value. The second happens because the properties widget cannot find the value it's looking for and defaults to the first one when the properties are opened, thus selecting and capturing the first window in the list (which is probably something we should fix in the properties view at some point but I don't want to dive into code that's even *more* cursed than xcomposite code right now) I think that this was a major oversight and that whoever wrote it however many countless years ago did not realize that this is something that maybe users don't want to have happen. So instead, this diff makes it so that on first creation, it creates a value that says "[Select a window to capture]" that keeps the capture inactive until a user actually chooses a window rather than the top-level window. It also makes it so that if the user has a window that is no longer valid, it will keep that window in the list and as the currently selected value, which prevents it from automatically selecting the first window in the list when properties are opened. (Have I mentioned xcomposite is cursed? Trying to debug xcomposite code in a debugger freezes my window compositor and forces me to do a hard restart of my entire computer, so I was forced to use printf debugging. Absolute nightmare-inducing code in here.)