1local lgi       = require("lgi")
2local gears_obj = require("gears.object")
3
4-- Emulate the C API classes. They differ from C API objects as connect_signal
5-- doesn't take an object as first argument and they support fallback properties
6-- handlers.
7local function _shim_fake_class()
8    local obj = gears_obj()
9    obj.data = {}
10
11    local meta = {
12        __index     = function()end,
13        __newindex = function()end,
14    }
15
16    obj._connect_signal = obj.connect_signal
17
18    function obj.connect_signal(name, func)
19        return obj._connect_signal(obj, name, func)
20    end
21
22    function obj.set_index_miss_handler(handler)
23        meta.__index = handler
24    end
25
26    function obj.set_newindex_miss_handler(handler)
27        meta.__newindex = handler
28    end
29
30    function obj.emit_signal(name, c, ...)
31        local conns = obj._signals[name] or {strong={}}
32        for func in pairs(conns.strong) do
33            func(c, ...)
34        end
35    end
36
37    return obj, meta
38end
39
40local awesome = _shim_fake_class()
41awesome._shim_fake_class = _shim_fake_class
42
43-- Avoid c.screen = acreen.focused() to be called, all tests will fail
44awesome.startup = true
45
46function awesome.register_xproperty()
47end
48
49function awesome.xkb_get_group_names()
50    return "pc+us+inet(evdev)"
51end
52
53function awesome.xkb_get_layout_group()
54    return 0
55end
56
57awesome.load_image = lgi.cairo.ImageSurface.create_from_png
58
59function awesome.pixbuf_to_surface(_, path)
60    return awesome.load_image(path)
61end
62
63-- Always show deprecated messages
64awesome.version = "v9999"
65
66-- SVG are composited. Without it we need a root surface
67awesome.composite_manager_running = true
68
69awesome._modifiers = {
70     Shift = {
71          {keycode = 50 , keysym = 'Shift_L'    },
72          {keycode = 62 , keysym = 'Shift_R'    },
73     },
74     Lock = {},
75     Control = {
76          {keycode = 37 , keysym = 'Control_L'  },
77          {keycode = 105, keysym = 'Control_R'  },
78     },
79     Mod1 = {
80          {keycode = 64 , keysym = 'Alt_L'      },
81          {keycode = 108, keysym = 'Alt_R'      },
82     },
83     Mod2 = {
84          {keycode = 77 , keysym = 'Num_Lock'   },
85     },
86     Mod3 = {},
87     Mod4 = {
88          {keycode = 133, keysym = 'Super_L'    },
89          {keycode = 134, keysym = 'Super_R'    },
90     },
91     Mod5 = {
92          {keycode = 203, keysym = 'Mode_switch'},
93     },
94}
95
96awesome._active_modifiers = {}
97
98return awesome
99
100-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
101