diff options
author | Scott Anderson <ascent12@hotmail.com> | 2017-05-13 23:56:40 +1200 |
---|---|---|
committer | Scott Anderson <ascent12@hotmail.com> | 2017-05-14 12:40:17 +1200 |
commit | c88f25258027257e1f6c56e9f76b8fc1feaedbd4 (patch) | |
tree | 6475e59c5a265f54a8b3a6e928b78070cb54bf3c /example | |
parent | 66e02e97ec3322b6453bf0db227fd2cd6c39c819 (diff) |
Initial D-Bus signal support.
Diffstat (limited to 'example')
-rw-r--r-- | example/main.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/example/main.c b/example/main.c index ed9eac0b..8da27594 100644 --- a/example/main.c +++ b/example/main.c @@ -81,15 +81,9 @@ int timer_done(void *data) { return 1; } -int dpms_on(void *data) { - struct wlr_backend *backend = data; - wlr_drm_backend_dpms(backend, false); - return 1; -} - -int dpms_off(void *data) { - struct wlr_backend *backend = data; - wlr_drm_backend_dpms(backend, true); +int timer_change_vt(void *data) { + struct wlr_session *session = data; + wlr_session_change_vt(session, 7); return 1; } @@ -117,7 +111,7 @@ int main() { struct wl_display *display = wl_display_create(); struct wl_event_loop *event_loop = wl_display_get_event_loop(display); - struct wlr_session *session = wlr_session_start(); + struct wlr_session *session = wlr_session_start(display); if (!session) { return 1; } @@ -132,14 +126,11 @@ int main() { bool done = false; struct wl_event_source *timer = wl_event_loop_add_timer(event_loop, timer_done, &done); - struct wl_event_source *timer_dpms_on = wl_event_loop_add_timer(event_loop, - dpms_on, wlr); - struct wl_event_source *timer_dpms_off = wl_event_loop_add_timer(event_loop, - dpms_off, wlr); - - wl_event_source_timer_update(timer, 20000); - wl_event_source_timer_update(timer_dpms_on, 5000); - wl_event_source_timer_update(timer_dpms_off, 10000); + struct wl_event_source *timer_vt = wl_event_loop_add_timer(event_loop, + timer_change_vt, session); + + wl_event_source_timer_update(timer, 30000); + wl_event_source_timer_update(timer_vt, 5000); while (!done) { wl_event_loop_dispatch(event_loop, 0); |