alex-zhang / fullscreenhack

A preload library that fixes fullscreen flash.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fullscreen hack for Flash Plugin
Author: Alistair Buxton <a.j.buxton@gmail.com>


Why
---

Flash plugin incorrectly determines the fullscreen resolution when 
using nvidia twinview. The result is that fullscreen windows fill 
the primary monitor, but the video gets scaled as if the primary 
monitor had the resolution of the total display area. Flash also
drops out of fullscreen mode when you try to do anything on the
other monitor.

How
---

There are two hacks. One for NPAPI Flash (Firefox etc) and one for 
PPAPI Flash (Google Chrome).

The NPAPI hack patches the XGetGeometry call which flash uses to 
determine screen size. If XGetGeometry would return the size of the 
root window, the patch causes it to instead return the size of a 
single monitor, selected based on mouse position. With NPAPI the
Flash fullscreen window opens on the monitor where the Flash plugin
was first opened, and mouse position is a good approximation as long
as you don't frag the window to another monitor. If you do, just 
reload the page.

The PPAPI hack works differently. This API has it's own fullscreen
functions which are just as broken as Flash. But these use X11 macros
which cannot be patched. So instead I patch the Display struct returned
by XOpenDisplay. Under PPAPI the Flash fullscreen window always opens
on the primary monitor as far as I can tell, so I always insert the 
dimensions of screen 0.

Fullscreen mode is no longer dropped when Flash loses focus by 
simply masking out the PropertyChange X events, stopping the 
behaviour entirely.

Config
------

None. (It works by Xinerama.)

Dependencies
------------

sudo apt-get install build-essential libx11-dev libxinerama-dev libxrandr-dev

Build
-----

make 

Usage
-----

env LD_PRELOAD=/path/to/libfshack-npapi.so firefox %u
env LD_PRELOAD=/path/to/libfshack-ppapi.so google-chrome %u

You can put these lines into custom .desktop files and then add those to your menus.


About

A preload library that fixes fullscreen flash.