X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=debian%2Fcfg_kludge_flash.lua;fp=debian%2Fcfg_kludge_flash.lua;h=54fca80aa219f62e44b06ff9425daa73dd06eb21;hb=562cb4d37ba7667ac846fc3d426b152d21ef2c22;hp=0000000000000000000000000000000000000000;hpb=3cfcd1c023ab3d0f130f0bc8119d1d628ab01a5a;p=ion3.git diff --git a/debian/cfg_kludge_flash.lua b/debian/cfg_kludge_flash.lua new file mode 100644 index 0000000..54fca80 --- /dev/null +++ b/debian/cfg_kludge_flash.lua @@ -0,0 +1,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 +)