File: cfg_kludge_flash.lua

package info (click to toggle)
ion3 20080825-1
  • links: PTS
  • area: non-free
  • in suites: lenny
  • size: 3,824 kB
  • ctags: 4,951
  • sloc: ansic: 44,434; makefile: 501; sh: 421; ruby: 90
file content (45 lines) | stat: -rw-r--r-- 1,247 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- Flash player opens full-screen windows from Firefox with size
-- request 200x200.  It closes them if they lose focus, but also if
-- they get focus too quickly.  Therefore set focus 200 ms after
-- such a window is mapped (this may need to be adjusted on slower
-- computers).

_NET_WM_STATE = ioncore.x_intern_atom('_NET_WM_STATE', false)
_NET_WM_STATE_FULLSCREEN = ioncore.x_intern_atom('_NET_WM_STATE_FULLSCREEN',
						 false)

function is_fullscreen(cwin)
    local state = ioncore.x_get_window_property(cwin:xid(), _NET_WM_STATE, 4,
						1, true)
    if state then
	for k, v in pairs(state) do
	    if v == _NET_WM_STATE_FULLSCREEN then
		return true
	    end
	end
    end
    return false
end

defwinprop {
    class = 'Firefox-bin',
    match = function(prop, cwin, id)
		local geom = cwin:geom()
		return is_fullscreen(cwin) and geom.w == 200 and geom.h == 200
	    end,
    switchto = false,
    flash_fullscreen = true,
}

ioncore.get_hook('clientwin_do_manage_alt'):add(
    function(cwin, table)
	local winprop = ioncore.getwinprop(cwin)
	if winprop and winprop.flash_fullscreen then
	    local timer = ioncore.create_timer()
	    timer:set(200, function() cwin:goto() end)
	    return true
	else
	    return false
	end
    end
)