diff options
-rw-r--r-- | include/sway/lock.h | 6 | ||||
-rw-r--r-- | sway/config/output.c | 2 | ||||
-rw-r--r-- | sway/lock.c | 29 |
3 files changed, 20 insertions, 17 deletions
diff --git a/include/sway/lock.h b/include/sway/lock.h new file mode 100644 index 00000000..5be0f969 --- /dev/null +++ b/include/sway/lock.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _SWAY_LOCK_H | ||
2 | #define _SWAY_LOCK_H | ||
3 | |||
4 | void arrange_locks(void); | ||
5 | |||
6 | #endif | ||
diff --git a/sway/config/output.c b/sway/config/output.c index 1ba72517..25f51dc7 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "sway/desktop/transaction.h" | 14 | #include "sway/desktop/transaction.h" |
15 | #include "sway/input/cursor.h" | 15 | #include "sway/input/cursor.h" |
16 | #include "sway/layers.h" | 16 | #include "sway/layers.h" |
17 | #include "sway/lock.h" | ||
17 | #include "sway/output.h" | 18 | #include "sway/output.h" |
18 | #include "sway/server.h" | 19 | #include "sway/server.h" |
19 | #include "sway/tree/arrange.h" | 20 | #include "sway/tree/arrange.h" |
@@ -955,6 +956,7 @@ static bool apply_resolved_output_configs(struct matched_output_config *configs, | |||
955 | } | 956 | } |
956 | 957 | ||
957 | arrange_root(); | 958 | arrange_root(); |
959 | arrange_locks(); | ||
958 | update_output_manager_config(&server); | 960 | update_output_manager_config(&server); |
959 | transaction_commit_dirty(); | 961 | transaction_commit_dirty(); |
960 | 962 | ||
diff --git a/sway/lock.c b/sway/lock.c index 289e8ca4..43f31330 100644 --- a/sway/lock.c +++ b/sway/lock.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "sway/layers.h" | 8 | #include "sway/layers.h" |
9 | #include "sway/output.h" | 9 | #include "sway/output.h" |
10 | #include "sway/server.h" | 10 | #include "sway/server.h" |
11 | #include "sway/lock.h" | ||
11 | 12 | ||
12 | struct sway_session_lock_output { | 13 | struct sway_session_lock_output { |
13 | struct wlr_scene_tree *tree; | 14 | struct wlr_scene_tree *tree; |
@@ -19,7 +20,6 @@ struct sway_session_lock_output { | |||
19 | struct wl_list link; // sway_session_lock::outputs | 20 | struct wl_list link; // sway_session_lock::outputs |
20 | 21 | ||
21 | struct wl_listener destroy; | 22 | struct wl_listener destroy; |
22 | struct wl_listener commit; | ||
23 | 23 | ||
24 | struct wlr_session_lock_surface_v1 *surface; | 24 | struct wlr_session_lock_surface_v1 *surface; |
25 | 25 | ||
@@ -89,6 +89,17 @@ static void lock_output_reconfigure(struct sway_session_lock_output *output) { | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | void arrange_locks(void) { | ||
93 | if (server.session_lock.lock == NULL) { | ||
94 | return; | ||
95 | } | ||
96 | |||
97 | struct sway_session_lock_output *lock_output; | ||
98 | wl_list_for_each(lock_output, &server.session_lock.lock->outputs, link) { | ||
99 | lock_output_reconfigure(lock_output); | ||
100 | } | ||
101 | } | ||
102 | |||
92 | static void handle_new_surface(struct wl_listener *listener, void *data) { | 103 | static void handle_new_surface(struct wl_listener *listener, void *data) { |
93 | struct sway_session_lock *lock = wl_container_of(listener, lock, new_surface); | 104 | struct sway_session_lock *lock = wl_container_of(listener, lock, new_surface); |
94 | struct wlr_session_lock_surface_v1 *lock_surface = data; | 105 | struct wlr_session_lock_surface_v1 *lock_surface = data; |
@@ -125,7 +136,6 @@ static void sway_session_lock_output_destroy(struct sway_session_lock_output *ou | |||
125 | wl_list_remove(&output->surface_map.link); | 136 | wl_list_remove(&output->surface_map.link); |
126 | } | 137 | } |
127 | 138 | ||
128 | wl_list_remove(&output->commit.link); | ||
129 | wl_list_remove(&output->destroy.link); | 139 | wl_list_remove(&output->destroy.link); |
130 | wl_list_remove(&output->link); | 140 | wl_list_remove(&output->link); |
131 | 141 | ||
@@ -138,18 +148,6 @@ static void lock_node_handle_destroy(struct wl_listener *listener, void *data) { | |||
138 | sway_session_lock_output_destroy(output); | 148 | sway_session_lock_output_destroy(output); |
139 | } | 149 | } |
140 | 150 | ||
141 | static void lock_output_handle_commit(struct wl_listener *listener, void *data) { | ||
142 | struct wlr_output_event_commit *event = data; | ||
143 | struct sway_session_lock_output *output = | ||
144 | wl_container_of(listener, output, commit); | ||
145 | if (event->state->committed & ( | ||
146 | WLR_OUTPUT_STATE_MODE | | ||
147 | WLR_OUTPUT_STATE_SCALE | | ||
148 | WLR_OUTPUT_STATE_TRANSFORM)) { | ||
149 | lock_output_reconfigure(output); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | static struct sway_session_lock_output *session_lock_output_create( | 151 | static struct sway_session_lock_output *session_lock_output_create( |
154 | struct sway_session_lock *lock, struct sway_output *output) { | 152 | struct sway_session_lock *lock, struct sway_output *output) { |
155 | struct sway_session_lock_output *lock_output = calloc(1, sizeof(*lock_output)); | 153 | struct sway_session_lock_output *lock_output = calloc(1, sizeof(*lock_output)); |
@@ -186,9 +184,6 @@ static struct sway_session_lock_output *session_lock_output_create( | |||
186 | lock_output->destroy.notify = lock_node_handle_destroy; | 184 | lock_output->destroy.notify = lock_node_handle_destroy; |
187 | wl_signal_add(&tree->node.events.destroy, &lock_output->destroy); | 185 | wl_signal_add(&tree->node.events.destroy, &lock_output->destroy); |
188 | 186 | ||
189 | lock_output->commit.notify = lock_output_handle_commit; | ||
190 | wl_signal_add(&output->wlr_output->events.commit, &lock_output->commit); | ||
191 | |||
192 | lock_output_reconfigure(lock_output); | 187 | lock_output_reconfigure(lock_output); |
193 | 188 | ||
194 | wl_list_insert(&lock->outputs, &lock_output->link); | 189 | wl_list_insert(&lock->outputs, &lock_output->link); |