diff options
-rw-r--r-- | include/sway/input/input-manager.h | 15 | ||||
-rw-r--r-- | sway/commands.c | 6 | ||||
-rw-r--r-- | sway/desktop/output.c | 2 | ||||
-rw-r--r-- | sway/desktop/wl_shell.c | 2 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 2 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 2 | ||||
-rw-r--r-- | sway/input/input-manager.c | 24 | ||||
-rw-r--r-- | sway/input/seat.c | 2 | ||||
-rw-r--r-- | sway/ipc-json.c | 4 | ||||
-rw-r--r-- | sway/ipc-server.c | 2 | ||||
-rw-r--r-- | sway/server.c | 2 |
11 files changed, 31 insertions, 32 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index c6c73dba..8515c738 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -27,24 +27,23 @@ struct sway_input_manager { | |||
27 | struct wl_listener new_input; | 27 | struct wl_listener new_input; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct sway_input_manager *sway_input_manager_create( | 30 | struct sway_input_manager *input_manager_create(struct sway_server *server); |
31 | struct sway_server *server); | ||
32 | 31 | ||
33 | bool sway_input_manager_has_focus(struct sway_input_manager *input, | 32 | bool input_manager_has_focus(struct sway_input_manager *input, |
34 | struct sway_container *container); | 33 | struct sway_container *container); |
35 | 34 | ||
36 | void sway_input_manager_set_focus(struct sway_input_manager *input, | 35 | void input_manager_set_focus(struct sway_input_manager *input, |
37 | struct sway_container *container); | 36 | struct sway_container *container); |
38 | 37 | ||
39 | void sway_input_manager_configure_xcursor(struct sway_input_manager *input); | 38 | void input_manager_configure_xcursor(struct sway_input_manager *input); |
40 | 39 | ||
41 | void sway_input_manager_apply_input_config(struct sway_input_manager *input, | 40 | void input_manager_apply_input_config(struct sway_input_manager *input, |
42 | struct input_config *input_config); | 41 | struct input_config *input_config); |
43 | 42 | ||
44 | void sway_input_manager_apply_seat_config(struct sway_input_manager *input, | 43 | void input_manager_apply_seat_config(struct sway_input_manager *input, |
45 | struct seat_config *seat_config); | 44 | struct seat_config *seat_config); |
46 | 45 | ||
47 | struct sway_seat *sway_input_manager_get_default_seat( | 46 | struct sway_seat *input_manager_get_default_seat( |
48 | struct sway_input_manager *input); | 47 | struct sway_input_manager *input); |
49 | 48 | ||
50 | struct sway_seat *input_manager_get_seat(struct sway_input_manager *input, | 49 | struct sway_seat *input_manager_get_seat(struct sway_input_manager *input, |
diff --git a/sway/commands.c b/sway/commands.c index 91b44fbf..dc6c867f 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -72,7 +72,7 @@ void apply_input_config(struct input_config *input) { | |||
72 | list_add(config->input_configs, input); | 72 | list_add(config->input_configs, input); |
73 | } | 73 | } |
74 | 74 | ||
75 | sway_input_manager_apply_input_config(input_manager, input); | 75 | input_manager_apply_input_config(input_manager, input); |
76 | } | 76 | } |
77 | 77 | ||
78 | void apply_seat_config(struct seat_config *seat) { | 78 | void apply_seat_config(struct seat_config *seat) { |
@@ -88,7 +88,7 @@ void apply_seat_config(struct seat_config *seat) { | |||
88 | list_add(config->seat_configs, seat); | 88 | list_add(config->seat_configs, seat); |
89 | } | 89 | } |
90 | 90 | ||
91 | sway_input_manager_apply_seat_config(input_manager, seat); | 91 | input_manager_apply_seat_config(input_manager, seat); |
92 | } | 92 | } |
93 | 93 | ||
94 | /* Keep alphabetized */ | 94 | /* Keep alphabetized */ |
@@ -262,7 +262,7 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) { | |||
262 | 262 | ||
263 | if (seat == NULL) { | 263 | if (seat == NULL) { |
264 | // passing a NULL seat means we just pick the default seat | 264 | // passing a NULL seat means we just pick the default seat |
265 | seat = sway_input_manager_get_default_seat(input_manager); | 265 | seat = input_manager_get_default_seat(input_manager); |
266 | if (!sway_assert(seat, "could not find a seat to run the command on")) { | 266 | if (!sway_assert(seat, "could not find a seat to run the command on")) { |
267 | return NULL; | 267 | return NULL; |
268 | } | 268 | } |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 86b023cb..ea3938a4 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -370,7 +370,7 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
370 | wl_list_init(&output->layers[i]); | 370 | wl_list_init(&output->layers[i]); |
371 | } | 371 | } |
372 | 372 | ||
373 | sway_input_manager_configure_xcursor(input_manager); | 373 | input_manager_configure_xcursor(input_manager); |
374 | 374 | ||
375 | wl_signal_add(&wlr_output->events.destroy, &output->destroy); | 375 | wl_signal_add(&wlr_output->events.destroy, &output->destroy); |
376 | output->destroy.notify = handle_destroy; | 376 | output->destroy.notify = handle_destroy; |
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index 3e275f2b..c44fcf27 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c | |||
@@ -138,5 +138,5 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | |||
138 | sway_view->swayc = cont; | 138 | sway_view->swayc = cont; |
139 | 139 | ||
140 | arrange_windows(cont->parent, -1, -1); | 140 | arrange_windows(cont->parent, -1, -1); |
141 | sway_input_manager_set_focus(input_manager, cont); | 141 | input_manager_set_focus(input_manager, cont); |
142 | } | 142 | } |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 286d52cc..cffe83fb 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -102,7 +102,7 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
102 | struct sway_container *cont = container_view_create(focus, view); | 102 | struct sway_container *cont = container_view_create(focus, view); |
103 | view->swayc = cont; | 103 | view->swayc = cont; |
104 | arrange_windows(cont->parent, -1, -1); | 104 | arrange_windows(cont->parent, -1, -1); |
105 | sway_input_manager_set_focus(input_manager, cont); | 105 | input_manager_set_focus(input_manager, cont); |
106 | 106 | ||
107 | view_damage_whole(sway_surface->view); | 107 | view_damage_whole(sway_surface->view); |
108 | } | 108 | } |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 8fb6cb52..17f827d9 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -148,7 +148,7 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
148 | struct sway_container *cont = container_view_create(focus, view); | 148 | struct sway_container *cont = container_view_create(focus, view); |
149 | view->swayc = cont; | 149 | view->swayc = cont; |
150 | arrange_windows(cont->parent, -1, -1); | 150 | arrange_windows(cont->parent, -1, -1); |
151 | sway_input_manager_set_focus(input_manager, cont); | 151 | input_manager_set_focus(input_manager, cont); |
152 | } | 152 | } |
153 | 153 | ||
154 | view_damage_whole(sway_surface->view); | 154 | view_damage_whole(sway_surface->view); |
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 66ade685..4f3c3ee5 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -26,7 +26,7 @@ struct seat_config *current_seat_config = NULL; | |||
26 | struct sway_seat *input_manager_current_seat(struct sway_input_manager *input) { | 26 | struct sway_seat *input_manager_current_seat(struct sway_input_manager *input) { |
27 | struct sway_seat *seat = config->handler_context.seat; | 27 | struct sway_seat *seat = config->handler_context.seat; |
28 | if (!seat) { | 28 | if (!seat) { |
29 | seat = sway_input_manager_get_default_seat(input_manager); | 29 | seat = input_manager_get_default_seat(input_manager); |
30 | } | 30 | } |
31 | return seat; | 31 | return seat; |
32 | } | 32 | } |
@@ -91,7 +91,7 @@ static bool input_has_seat_configuration(struct sway_input_manager *input) { | |||
91 | return false; | 91 | return false; |
92 | } | 92 | } |
93 | 93 | ||
94 | static void sway_input_manager_libinput_config_pointer(struct sway_input_device *input_device) { | 94 | static void input_manager_libinput_config_pointer(struct sway_input_device *input_device) { |
95 | struct wlr_input_device *wlr_device = input_device->wlr_device; | 95 | struct wlr_input_device *wlr_device = input_device->wlr_device; |
96 | struct input_config *ic = input_device->config; | 96 | struct input_config *ic = input_device->config; |
97 | struct libinput_device *libinput_device; | 97 | struct libinput_device *libinput_device; |
@@ -101,7 +101,7 @@ static void sway_input_manager_libinput_config_pointer(struct sway_input_device | |||
101 | } | 101 | } |
102 | 102 | ||
103 | libinput_device = wlr_libinput_get_device_handle(wlr_device); | 103 | libinput_device = wlr_libinput_get_device_handle(wlr_device); |
104 | wlr_log(L_DEBUG, "sway_input_manager_libinput_config_pointer(%s)", ic->identifier); | 104 | wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)", ic->identifier); |
105 | 105 | ||
106 | if (ic->accel_profile != INT_MIN) { | 106 | if (ic->accel_profile != INT_MIN) { |
107 | wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", | 107 | wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", |
@@ -214,7 +214,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) { | |||
214 | } | 214 | } |
215 | 215 | ||
216 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { | 216 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { |
217 | sway_input_manager_libinput_config_pointer(input_device); | 217 | input_manager_libinput_config_pointer(input_device); |
218 | } | 218 | } |
219 | 219 | ||
220 | struct sway_seat *seat = NULL; | 220 | struct sway_seat *seat = NULL; |
@@ -256,7 +256,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) { | |||
256 | input_device->device_destroy.notify = handle_device_destroy; | 256 | input_device->device_destroy.notify = handle_device_destroy; |
257 | } | 257 | } |
258 | 258 | ||
259 | struct sway_input_manager *sway_input_manager_create( | 259 | struct sway_input_manager *input_manager_create( |
260 | struct sway_server *server) { | 260 | struct sway_server *server) { |
261 | struct sway_input_manager *input = | 261 | struct sway_input_manager *input = |
262 | calloc(1, sizeof(struct sway_input_manager)); | 262 | calloc(1, sizeof(struct sway_input_manager)); |
@@ -277,7 +277,7 @@ struct sway_input_manager *sway_input_manager_create( | |||
277 | return input; | 277 | return input; |
278 | } | 278 | } |
279 | 279 | ||
280 | bool sway_input_manager_has_focus(struct sway_input_manager *input, | 280 | bool input_manager_has_focus(struct sway_input_manager *input, |
281 | struct sway_container *container) { | 281 | struct sway_container *container) { |
282 | struct sway_seat *seat = NULL; | 282 | struct sway_seat *seat = NULL; |
283 | wl_list_for_each(seat, &input->seats, link) { | 283 | wl_list_for_each(seat, &input->seats, link) { |
@@ -289,7 +289,7 @@ bool sway_input_manager_has_focus(struct sway_input_manager *input, | |||
289 | return false; | 289 | return false; |
290 | } | 290 | } |
291 | 291 | ||
292 | void sway_input_manager_set_focus(struct sway_input_manager *input, | 292 | void input_manager_set_focus(struct sway_input_manager *input, |
293 | struct sway_container *container) { | 293 | struct sway_container *container) { |
294 | struct sway_seat *seat ; | 294 | struct sway_seat *seat ; |
295 | wl_list_for_each(seat, &input->seats, link) { | 295 | wl_list_for_each(seat, &input->seats, link) { |
@@ -297,7 +297,7 @@ void sway_input_manager_set_focus(struct sway_input_manager *input, | |||
297 | } | 297 | } |
298 | } | 298 | } |
299 | 299 | ||
300 | void sway_input_manager_apply_input_config(struct sway_input_manager *input, | 300 | void input_manager_apply_input_config(struct sway_input_manager *input, |
301 | struct input_config *input_config) { | 301 | struct input_config *input_config) { |
302 | struct sway_input_device *input_device = NULL; | 302 | struct sway_input_device *input_device = NULL; |
303 | wl_list_for_each(input_device, &input->devices, link) { | 303 | wl_list_for_each(input_device, &input->devices, link) { |
@@ -306,7 +306,7 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input, | |||
306 | input_device->config = copy_input_config(input_config); | 306 | input_device->config = copy_input_config(input_config); |
307 | 307 | ||
308 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { | 308 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { |
309 | sway_input_manager_libinput_config_pointer(input_device); | 309 | input_manager_libinput_config_pointer(input_device); |
310 | } | 310 | } |
311 | 311 | ||
312 | struct sway_seat *seat = NULL; | 312 | struct sway_seat *seat = NULL; |
@@ -317,7 +317,7 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input, | |||
317 | } | 317 | } |
318 | } | 318 | } |
319 | 319 | ||
320 | void sway_input_manager_apply_seat_config(struct sway_input_manager *input, | 320 | void input_manager_apply_seat_config(struct sway_input_manager *input, |
321 | struct seat_config *seat_config) { | 321 | struct seat_config *seat_config) { |
322 | wlr_log(L_DEBUG, "applying new seat config for seat %s", | 322 | wlr_log(L_DEBUG, "applying new seat config for seat %s", |
323 | seat_config->name); | 323 | seat_config->name); |
@@ -373,14 +373,14 @@ void sway_input_manager_apply_seat_config(struct sway_input_manager *input, | |||
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | void sway_input_manager_configure_xcursor(struct sway_input_manager *input) { | 376 | void input_manager_configure_xcursor(struct sway_input_manager *input) { |
377 | struct sway_seat *seat = NULL; | 377 | struct sway_seat *seat = NULL; |
378 | wl_list_for_each(seat, &input->seats, link) { | 378 | wl_list_for_each(seat, &input->seats, link) { |
379 | seat_configure_xcursor(seat); | 379 | seat_configure_xcursor(seat); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | struct sway_seat *sway_input_manager_get_default_seat( | 383 | struct sway_seat *input_manager_get_default_seat( |
384 | struct sway_input_manager *input) { | 384 | struct sway_input_manager *input) { |
385 | struct sway_seat *seat = NULL; | 385 | struct sway_seat *seat = NULL; |
386 | wl_list_for_each(seat, &input->seats, link) { | 386 | wl_list_for_each(seat, &input->seats, link) { |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 70395144..c2ecd1c4 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -364,7 +364,7 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
364 | } | 364 | } |
365 | 365 | ||
366 | if (last_focus && last_focus->type == C_VIEW && | 366 | if (last_focus && last_focus->type == C_VIEW && |
367 | !sway_input_manager_has_focus(seat->input, last_focus)) { | 367 | !input_manager_has_focus(seat->input, last_focus)) { |
368 | struct sway_view *view = last_focus->sway_view; | 368 | struct sway_view *view = last_focus->sway_view; |
369 | view_set_activated(view, false); | 369 | view_set_activated(view, false); |
370 | } | 370 | } |
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 1b906e6f..3427c8ec 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -88,7 +88,7 @@ static void ipc_json_describe_output(struct sway_container *container, json_obje | |||
88 | json_object_new_string( | 88 | json_object_new_string( |
89 | ipc_json_get_output_transform(wlr_output->transform))); | 89 | ipc_json_get_output_transform(wlr_output->transform))); |
90 | 90 | ||
91 | struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); | 91 | struct sway_seat *seat = input_manager_get_default_seat(input_manager); |
92 | const char *ws = NULL; | 92 | const char *ws = NULL; |
93 | if (seat) { | 93 | if (seat) { |
94 | struct sway_container *focus = | 94 | struct sway_container *focus = |
@@ -139,7 +139,7 @@ json_object *ipc_json_describe_container(struct sway_container *c) { | |||
139 | return NULL; | 139 | return NULL; |
140 | } | 140 | } |
141 | 141 | ||
142 | struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); | 142 | struct sway_seat *seat = input_manager_get_default_seat(input_manager); |
143 | bool focused = seat_get_focus(seat) == c; | 143 | bool focused = seat_get_focus(seat) == c; |
144 | 144 | ||
145 | json_object *object = json_object_new_object(); | 145 | json_object *object = json_object_new_object(); |
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 8c06f71b..df5fb699 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -388,7 +388,7 @@ static void ipc_get_workspaces_callback(struct sway_container *workspace, | |||
388 | // override the default focused indicator because | 388 | // override the default focused indicator because |
389 | // it's set differently for the get_workspaces reply | 389 | // it's set differently for the get_workspaces reply |
390 | struct sway_seat *seat = | 390 | struct sway_seat *seat = |
391 | sway_input_manager_get_default_seat(input_manager); | 391 | input_manager_get_default_seat(input_manager); |
392 | struct sway_container *focused_ws = seat_get_focus(seat); | 392 | struct sway_container *focused_ws = seat_get_focus(seat); |
393 | if (focused_ws != NULL && focused_ws->type != C_WORKSPACE) { | 393 | if (focused_ws != NULL && focused_ws->type != C_WORKSPACE) { |
394 | focused_ws = container_parent(focused_ws, C_WORKSPACE); | 394 | focused_ws = container_parent(focused_ws, C_WORKSPACE); |
diff --git a/sway/server.c b/sway/server.c index f5cc199c..54945312 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -109,7 +109,7 @@ bool server_init(struct sway_server *server) { | |||
109 | return false; | 109 | return false; |
110 | } | 110 | } |
111 | 111 | ||
112 | input_manager = sway_input_manager_create(server); | 112 | input_manager = input_manager_create(server); |
113 | return true; | 113 | return true; |
114 | } | 114 | } |
115 | 115 | ||