diff options
author | Simon Ser <contact@emersion.fr> | 2023-06-19 21:16:23 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-06-23 12:32:38 +0200 |
commit | b762f455d942e81e076a4a4d475fb9926372da16 (patch) | |
tree | 225c427277bc20279befc7381ad4766fe17a803f /include | |
parent | Use wlr_cursor_unset_image() (diff) | |
download | sway-b762f455d942e81e076a4a4d475fb9926372da16.tar.gz sway-b762f455d942e81e076a4a4d475fb9926372da16.tar.zst sway-b762f455d942e81e076a4a4d475fb9926372da16.zip |
idle-inhibit-v1: simplify with server global
We only have a single running server, no need to keep track of
multiple server instances. Also no need to support multiple
idle inhibit managers.
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/desktop/idle_inhibit_v1.h | 11 | ||||
-rw-r--r-- | include/sway/server.h | 3 |
2 files changed, 5 insertions, 9 deletions
diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h index 58d54c68..6dda1af9 100644 --- a/include/sway/desktop/idle_inhibit_v1.h +++ b/include/sway/desktop/idle_inhibit_v1.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H | 2 | #define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H |
3 | #include <wlr/types/wlr_idle_inhibit_v1.h> | 3 | #include <wlr/types/wlr_idle_inhibit_v1.h> |
4 | #include <wlr/types/wlr_idle.h> | 4 | #include <wlr/types/wlr_idle.h> |
5 | #include "sway/server.h" | ||
6 | 5 | ||
7 | enum sway_idle_inhibit_mode { | 6 | enum sway_idle_inhibit_mode { |
8 | INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible) | 7 | INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible) |
@@ -16,12 +15,9 @@ struct sway_idle_inhibit_manager_v1 { | |||
16 | struct wlr_idle_inhibit_manager_v1 *wlr_manager; | 15 | struct wlr_idle_inhibit_manager_v1 *wlr_manager; |
17 | struct wl_listener new_idle_inhibitor_v1; | 16 | struct wl_listener new_idle_inhibitor_v1; |
18 | struct wl_list inhibitors; | 17 | struct wl_list inhibitors; |
19 | |||
20 | struct wlr_idle *idle; | ||
21 | }; | 18 | }; |
22 | 19 | ||
23 | struct sway_idle_inhibitor_v1 { | 20 | struct sway_idle_inhibitor_v1 { |
24 | struct sway_idle_inhibit_manager_v1 *manager; | ||
25 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor; | 21 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor; |
26 | struct sway_view *view; | 22 | struct sway_view *view; |
27 | enum sway_idle_inhibit_mode mode; | 23 | enum sway_idle_inhibit_mode mode; |
@@ -33,8 +29,7 @@ struct sway_idle_inhibitor_v1 { | |||
33 | bool sway_idle_inhibit_v1_is_active( | 29 | bool sway_idle_inhibit_v1_is_active( |
34 | struct sway_idle_inhibitor_v1 *inhibitor); | 30 | struct sway_idle_inhibitor_v1 *inhibitor); |
35 | 31 | ||
36 | void sway_idle_inhibit_v1_check_active( | 32 | void sway_idle_inhibit_v1_check_active(void); |
37 | struct sway_idle_inhibit_manager_v1 *manager); | ||
38 | 33 | ||
39 | void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view, | 34 | void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view, |
40 | enum sway_idle_inhibit_mode mode); | 35 | enum sway_idle_inhibit_mode mode); |
@@ -48,6 +43,6 @@ struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_vi | |||
48 | void sway_idle_inhibit_v1_user_inhibitor_destroy( | 43 | void sway_idle_inhibit_v1_user_inhibitor_destroy( |
49 | struct sway_idle_inhibitor_v1 *inhibitor); | 44 | struct sway_idle_inhibitor_v1 *inhibitor); |
50 | 45 | ||
51 | struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create( | 46 | bool sway_idle_inhibit_manager_v1_init(void); |
52 | struct wl_display *wl_display, struct wlr_idle *idle); | 47 | |
53 | #endif | 48 | #endif |
diff --git a/include/sway/server.h b/include/sway/server.h index aaa8781b..0e4ec2be 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <wlr/types/wlr_xdg_shell.h> | 21 | #include <wlr/types/wlr_xdg_shell.h> |
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "list.h" | 23 | #include "list.h" |
24 | #include "sway/desktop/idle_inhibit_v1.h" | ||
24 | #if HAVE_XWAYLAND | 25 | #if HAVE_XWAYLAND |
25 | #include "sway/xwayland.h" | 26 | #include "sway/xwayland.h" |
26 | #endif | 27 | #endif |
@@ -53,7 +54,7 @@ struct sway_server { | |||
53 | 54 | ||
54 | struct wlr_idle *idle; | 55 | struct wlr_idle *idle; |
55 | struct wlr_idle_notifier_v1 *idle_notifier_v1; | 56 | struct wlr_idle_notifier_v1 *idle_notifier_v1; |
56 | struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; | 57 | struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1; |
57 | 58 | ||
58 | struct wlr_layer_shell_v1 *layer_shell; | 59 | struct wlr_layer_shell_v1 *layer_shell; |
59 | struct wl_listener layer_shell_surface; | 60 | struct wl_listener layer_shell_surface; |