diff options
Diffstat (limited to 'swayidle/main.c')
-rw-r--r-- | swayidle/main.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/swayidle/main.c b/swayidle/main.c index 64e45036..678d622f 100644 --- a/swayidle/main.c +++ b/swayidle/main.c | |||
@@ -1,22 +1,21 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _XOPEN_SOURCE 500 |
2 | #include <errno.h> | ||
2 | #include <getopt.h> | 3 | #include <getopt.h> |
3 | #include <signal.h> | ||
4 | #include <pthread.h> | 4 | #include <pthread.h> |
5 | #include <signal.h> | ||
5 | #include <stdio.h> | 6 | #include <stdio.h> |
6 | #include <stdlib.h> | 7 | #include <stdlib.h> |
7 | #include <errno.h> | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | #include <sys/wait.h> | 9 | #include <sys/wait.h> |
10 | #include <unistd.h> | 10 | #include <unistd.h> |
11 | #include <wayland-client-protocol.h> | 11 | #include <wayland-client-protocol.h> |
12 | #include <wayland-client.h> | 12 | #include <wayland-client.h> |
13 | #include <wayland-server.h> | ||
13 | #include <wayland-util.h> | 14 | #include <wayland-util.h> |
14 | #include <wlr/config.h> | 15 | #include <wlr/config.h> |
15 | #include <wlr/util/log.h> | 16 | #include <wlr/util/log.h> |
16 | #include <wlr/types/wlr_output_layout.h> | ||
17 | #include <wlr/types/wlr_output.h> | ||
18 | #include "idle-client-protocol.h" | ||
19 | #include "config.h" | 17 | #include "config.h" |
18 | #include "idle-client-protocol.h" | ||
20 | #include "list.h" | 19 | #include "list.h" |
21 | #ifdef SWAY_IDLE_HAS_SYSTEMD | 20 | #ifdef SWAY_IDLE_HAS_SYSTEMD |
22 | #include <systemd/sd-bus.h> | 21 | #include <systemd/sd-bus.h> |
@@ -36,7 +35,6 @@ struct swayidle_state { | |||
36 | struct wl_display *display; | 35 | struct wl_display *display; |
37 | struct org_kde_kwin_idle_timeout *idle_timer; | 36 | struct org_kde_kwin_idle_timeout *idle_timer; |
38 | struct org_kde_kwin_idle_timeout *lock_timer; | 37 | struct org_kde_kwin_idle_timeout *lock_timer; |
39 | struct wlr_output_layout *layout; | ||
40 | struct wl_event_loop *event_loop; | 38 | struct wl_event_loop *event_loop; |
41 | list_t *timeout_cmds; | 39 | list_t *timeout_cmds; |
42 | } state; | 40 | } state; |
@@ -165,7 +163,7 @@ static int dbus_event(int fd, uint32_t mask, void *data) { | |||
165 | 163 | ||
166 | void setup_sleep_listener() { | 164 | void setup_sleep_listener() { |
167 | struct sd_bus *bus; | 165 | struct sd_bus *bus; |
168 | 166 | ||
169 | int ret = sd_bus_default_system(&bus); | 167 | int ret = sd_bus_default_system(&bus); |
170 | if (ret < 0) { | 168 | if (ret < 0) { |
171 | wlr_log(WLR_ERROR, "Failed to open D-Bus connection: %s", | 169 | wlr_log(WLR_ERROR, "Failed to open D-Bus connection: %s", |
@@ -360,7 +358,7 @@ static int display_event(int fd, uint32_t mask, void *data) { | |||
360 | if (wl_display_dispatch(state.display) < 0) { | 358 | if (wl_display_dispatch(state.display) < 0) { |
361 | wlr_log_errno(WLR_ERROR, "wl_display_dispatch failed, exiting"); | 359 | wlr_log_errno(WLR_ERROR, "wl_display_dispatch failed, exiting"); |
362 | sway_terminate(0); | 360 | sway_terminate(0); |
363 | }; | 361 | } |
364 | return 0; | 362 | return 0; |
365 | } | 363 | } |
366 | 364 | ||
@@ -397,7 +395,6 @@ int main(int argc, char *argv[]) { | |||
397 | struct wl_registry *registry = wl_display_get_registry(state.display); | 395 | struct wl_registry *registry = wl_display_get_registry(state.display); |
398 | wl_registry_add_listener(registry, ®istry_listener, NULL); | 396 | wl_registry_add_listener(registry, ®istry_listener, NULL); |
399 | wl_display_roundtrip(state.display); | 397 | wl_display_roundtrip(state.display); |
400 | state.layout = wlr_output_layout_create(); | ||
401 | state.event_loop = wl_event_loop_create(); | 398 | state.event_loop = wl_event_loop_create(); |
402 | 399 | ||
403 | if (idle_manager == NULL) { | 400 | if (idle_manager == NULL) { |