As we all know, flash is downright terrible, and should preferably go away as quickly as possible.
However, while we’re forced to contend with it, let’s at least try to make it as painless as possible.
One common cause of frustration with flash in multi-monitor mode, is the fact fullscreen flash windows (youtube videos, for example) close as soon as you click anywhere else.
At least on Linux, I know this to be true. On windows, there are a lot of other problems, but not this one specifically.
This is very frustrating if you have more than one monitor. It completely prevents you from watching something on one monitor, and working on the other. No matter if it’s an instructional video, or just some background entertainment, this is clearly a reasonable workflow that fails.
Now, we don’t have the source for flash (I wish), so we are limited to a solution that can either be applied directly to the .so-file, or in the frameworks around the browser.
It would also be great if the fix would be reasonably version-independant, so we don’t have to come up with a complicated binary patch for each point release. Finally, a safe idempotent way of applying it would be great.
After a lot of digging, I discovered part of the mechanism. The Windows Manager (WM) extension to X11, mandates that a client (a window manager) that changes windows, MUST send a _NET_ACTIVE_WINDOW to the root window.
It turns out that this message is crucial to the fullscreen process. Flash is set to listen for _NET_ACTIVE_WINDOW, and go to non-fullscreen mode whenever it receives such a message. That is, whenever any other window is selected.
After experimentation, I concluded that by failing to receive _NET_ACTIVE_WINDOW, flash will stay nicely in fullscreen mode. Everything else works as expected.
A very simply way to fix flash, then, is to hack the binary to make it listen for another message. This can be done programmatically, like so (the script is 1 line, broken into 2 lines by a backspace. It works either way):
$ sed -i -re s/_NET_ACTIVE_WINDOW/XNET_ACTIVE_WINDOW/ \ /usr/lib/.../libflashplayer.so
Where the last part is the path to your
libflashplayer.so. This code performs a scripted search-replace of the string
_NET_ACTIVE_WINDOW and substitutes
XNET_ACTIVE_WINDOW. By making flash listen for a message that does not exist, we can be sure it will never react to the real
_NET_ACTIVE_WINDOW, which is what we want.
If you want a backup file, use
$ sed -i.orig -re ...
but that is usually not necessary.
After this, simply restart any browsers that might use the flash binary, and behold! Full screen flash that works!
You can run the sed command as many times as you want. It’s completely idempotent, and it’s reasonably non-dangerous. So far, I’m yet to encounter a version of flash that will change in any way except the desired way, by no longer having the _NET_ACTIVE_WINDOW string.
In an upcoming post, we’ll take a look at how we can fix the resolution of fullscreen flash. That’s an entirely different problem, with an entirely different solution. Till then!