Window::setOnActivities, there is some logic for removing activities from the list passed to the function, as well as for detecting whether to set a window to be visible on all activities or not. Unfortunately, when KWin is first starting (like when
kwin_x11 --replace is ran in a terminal), the constant
allActivities in this function appears to be filled entirely with null activity UUIDs (why, I do not know). When confronted with this situation, the function ignores the entire list of activities passed to it, resulting in the behavior described at https://bugs.kde.org/show_bug.cgi?id=438312.
This patch checks for the existence of even one null UUID in the
allActivities constant. In the event one is found, the code that trims the list of activities is disabled, as is the code for determining if a window should be set as visible on all activities. This causes the function to work as expected during KWin's startup, while also not interfering with the function's operation once no null UUIDs are found in
allActivities. In my testing, this appears to resolve the bug entirely.
WARNING: I do not know C++. Nor have I ever worked with KWin before. If this patch looks awful, that's probably because it is. I'm skilled with programming, but C++ is mostly foreign to me. I tried to adhere to the coding style I saw in the rest of the KWin code, and I did some testing to make sure that the logic actually worked right, but just, give it an extra-close look. I'm perfectly happy to be grilled for any mistakes I made.