Add idle tracking

Note that this does not do much without an idle manager "on the other
side". See, for example, swayidle: https://github.com/swaywm/sway/blob/master/swayidle/swayidle.1.scd

Fixes #7.
This commit is contained in:
Jente Hidskes 2019-01-04 17:06:27 +01:00
parent 96372c145f
commit bf58eadf50
3 changed files with 30 additions and 0 deletions

11
cage.c
View file

@ -20,6 +20,7 @@
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_output_layout.h>
#if CAGE_HAS_XWAYLAND
#include <wlr/types/wlr_xcursor_manager.h>
@ -151,6 +152,13 @@ main(int argc, char *argv[])
goto end;
}
server.idle = wlr_idle_create(server.wl_display);
if (!server.idle) {
wlr_log(WLR_ERROR, "Unable to create the idle tracker");
ret = 1;
goto end;
}
xdg_shell = wlr_xdg_shell_create(server.wl_display);
if (!xdg_shell) {
wlr_log(WLR_ERROR, "Unable to create the XDG shell interface");
@ -228,6 +236,9 @@ end:
wlr_xcursor_manager_destroy(xcursor_manager);
#endif
wlr_xdg_shell_destroy(xdg_shell);
if (server.idle) {
wlr_idle_destroy(server.idle);
}
wlr_data_device_manager_destroy(data_device_mgr);
wlr_compositor_destroy(compositor);
wlr_output_layout_destroy(server.output_layout);