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
46
47
48
|
namespace Caribou {
[DBus(name = "org.gnome.Caribou.Keyboard")]
public abstract class KeyboardService : Object {
public abstract void set_cursor_location(int x, int y, int w, int h);
public abstract void set_entry_location(int x, int y, int w, int h);
public abstract void show(uint32 timestamp);
public abstract void hide(uint32 timestamp);
protected void register_keyboard (string name) {
string dbus_name = @"org.gnome.Caribou.$name";
Bus.own_name (BusType.SESSION, dbus_name, BusNameOwnerFlags.NONE,
on_bus_acquired, on_impl_name_acquired, on_impl_name_lost);
}
private void on_bus_acquired (DBusConnection conn) {
}
private void on_impl_name_lost (DBusConnection conn, string name) {
stderr.printf ("Could not acquire %s\n", name);
}
private void on_name_lost (DBusConnection conn, string name) {
stderr.printf ("Could not acquire %s\n", name);
name_lost (name);
}
protected virtual void name_lost (string name) {
stderr.printf ("default\n");
}
private void on_impl_name_acquired (DBusConnection conn, string name) {
Bus.own_name (
BusType.SESSION, "org.gnome.Caribou.Keyboard",
BusNameOwnerFlags.ALLOW_REPLACEMENT,
on_bus_acquired, on_generic_name_acquired, on_name_lost);
}
private void on_generic_name_acquired (DBusConnection conn, string name) {
try {
string path = @"/org/gnome/Caribou/Keyboard";
conn.register_object (path, this);
} catch (IOError e) {
stderr.printf ("Could not register service: %s\n", e.message);
}
}
}
}
|