diff options
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | sway/config/input.c | 3 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 55 | ||||
-rw-r--r-- | sway/input/input-manager.c | 6 | ||||
-rw-r--r-- | sway/ipc-server.c | 13 | ||||
-rw-r--r-- | sway/tree/view.c | 10 |
6 files changed, 42 insertions, 49 deletions
diff --git a/meson.build b/meson.build index 82e4a96f..76eaff20 100644 --- a/meson.build +++ b/meson.build | |||
@@ -22,6 +22,10 @@ datadir = get_option('datadir') | |||
22 | sysconfdir = get_option('sysconfdir') | 22 | sysconfdir = get_option('sysconfdir') |
23 | prefix = get_option('prefix') | 23 | prefix = get_option('prefix') |
24 | 24 | ||
25 | if is_freebsd | ||
26 | add_project_arguments('-D_C11_SOURCE', language: 'c') | ||
27 | endif | ||
28 | |||
25 | swayidle_deps = [] | 29 | swayidle_deps = [] |
26 | 30 | ||
27 | jsonc = dependency('json-c', version: '>=0.13') | 31 | jsonc = dependency('json-c', version: '>=0.13') |
diff --git a/sway/config/input.c b/sway/config/input.c index fffc8518..6b43a5b9 100644 --- a/sway/config/input.c +++ b/sway/config/input.c | |||
@@ -52,6 +52,9 @@ void merge_input_config(struct input_config *dst, struct input_config *src) { | |||
52 | if (src->dwt != INT_MIN) { | 52 | if (src->dwt != INT_MIN) { |
53 | dst->dwt = src->dwt; | 53 | dst->dwt = src->dwt; |
54 | } | 54 | } |
55 | if (src->left_handed != INT_MIN) { | ||
56 | dst->left_handed = src->left_handed; | ||
57 | } | ||
55 | if (src->middle_emulation != INT_MIN) { | 58 | if (src->middle_emulation != INT_MIN) { |
56 | dst->middle_emulation = src->middle_emulation; | 59 | dst->middle_emulation = src->middle_emulation; |
57 | } | 60 | } |
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 797f6b4c..34d99d52 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -31,14 +31,14 @@ struct sway_transaction_instruction { | |||
31 | struct sway_transaction *transaction; | 31 | struct sway_transaction *transaction; |
32 | struct sway_node *node; | 32 | struct sway_node *node; |
33 | union { | 33 | union { |
34 | struct sway_output_state *output_state; | 34 | struct sway_output_state output_state; |
35 | struct sway_workspace_state *workspace_state; | 35 | struct sway_workspace_state workspace_state; |
36 | struct sway_container_state *container_state; | 36 | struct sway_container_state container_state; |
37 | }; | 37 | }; |
38 | uint32_t serial; | 38 | uint32_t serial; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static struct sway_transaction *transaction_create() { | 41 | static struct sway_transaction *transaction_create(void) { |
42 | struct sway_transaction *transaction = | 42 | struct sway_transaction *transaction = |
43 | calloc(1, sizeof(struct sway_transaction)); | 43 | calloc(1, sizeof(struct sway_transaction)); |
44 | if (!sway_assert(transaction, "Unable to allocate transaction")) { | 44 | if (!sway_assert(transaction, "Unable to allocate transaction")) { |
@@ -86,14 +86,7 @@ static void transaction_destroy(struct sway_transaction *transaction) { | |||
86 | 86 | ||
87 | static void copy_output_state(struct sway_output *output, | 87 | static void copy_output_state(struct sway_output *output, |
88 | struct sway_transaction_instruction *instruction) { | 88 | struct sway_transaction_instruction *instruction) { |
89 | struct sway_output_state *state = | 89 | struct sway_output_state *state = &instruction->output_state; |
90 | calloc(1, sizeof(struct sway_output_state)); | ||
91 | if (!state) { | ||
92 | wlr_log(WLR_ERROR, "Could not allocate output state"); | ||
93 | return; | ||
94 | } | ||
95 | instruction->output_state = state; | ||
96 | |||
97 | state->workspaces = create_list(); | 90 | state->workspaces = create_list(); |
98 | list_cat(state->workspaces, output->workspaces); | 91 | list_cat(state->workspaces, output->workspaces); |
99 | 92 | ||
@@ -102,13 +95,7 @@ static void copy_output_state(struct sway_output *output, | |||
102 | 95 | ||
103 | static void copy_workspace_state(struct sway_workspace *ws, | 96 | static void copy_workspace_state(struct sway_workspace *ws, |
104 | struct sway_transaction_instruction *instruction) { | 97 | struct sway_transaction_instruction *instruction) { |
105 | struct sway_workspace_state *state = | 98 | struct sway_workspace_state *state = &instruction->workspace_state; |
106 | calloc(1, sizeof(struct sway_workspace_state)); | ||
107 | if (!state) { | ||
108 | wlr_log(WLR_ERROR, "Could not allocate workspace state"); | ||
109 | return; | ||
110 | } | ||
111 | instruction->workspace_state = state; | ||
112 | 99 | ||
113 | state->fullscreen = ws->fullscreen; | 100 | state->fullscreen = ws->fullscreen; |
114 | state->x = ws->x; | 101 | state->x = ws->x; |
@@ -138,13 +125,7 @@ static void copy_workspace_state(struct sway_workspace *ws, | |||
138 | 125 | ||
139 | static void copy_container_state(struct sway_container *container, | 126 | static void copy_container_state(struct sway_container *container, |
140 | struct sway_transaction_instruction *instruction) { | 127 | struct sway_transaction_instruction *instruction) { |
141 | struct sway_container_state *state = | 128 | struct sway_container_state *state = &instruction->container_state; |
142 | calloc(1, sizeof(struct sway_container_state)); | ||
143 | if (!state) { | ||
144 | wlr_log(WLR_ERROR, "Could not allocate container state"); | ||
145 | return; | ||
146 | } | ||
147 | instruction->container_state = state; | ||
148 | 129 | ||
149 | state->layout = container->layout; | 130 | state->layout = container->layout; |
150 | state->con_x = container->x; | 131 | state->con_x = container->x; |
@@ -301,15 +282,15 @@ static void transaction_apply(struct sway_transaction *transaction) { | |||
301 | case N_ROOT: | 282 | case N_ROOT: |
302 | break; | 283 | break; |
303 | case N_OUTPUT: | 284 | case N_OUTPUT: |
304 | apply_output_state(node->sway_output, instruction->output_state); | 285 | apply_output_state(node->sway_output, &instruction->output_state); |
305 | break; | 286 | break; |
306 | case N_WORKSPACE: | 287 | case N_WORKSPACE: |
307 | apply_workspace_state(node->sway_workspace, | 288 | apply_workspace_state(node->sway_workspace, |
308 | instruction->workspace_state); | 289 | &instruction->workspace_state); |
309 | break; | 290 | break; |
310 | case N_CONTAINER: | 291 | case N_CONTAINER: |
311 | apply_container_state(node->sway_container, | 292 | apply_container_state(node->sway_container, |
312 | instruction->container_state); | 293 | &instruction->container_state); |
313 | break; | 294 | break; |
314 | } | 295 | } |
315 | 296 | ||
@@ -335,7 +316,7 @@ static bool transaction_same_nodes(struct sway_transaction *a, | |||
335 | return true; | 316 | return true; |
336 | } | 317 | } |
337 | 318 | ||
338 | static void transaction_progress_queue() { | 319 | static void transaction_progress_queue(void) { |
339 | if (!server.transactions->length) { | 320 | if (!server.transactions->length) { |
340 | return; | 321 | return; |
341 | } | 322 | } |
@@ -390,7 +371,7 @@ static bool should_configure(struct sway_node *node, | |||
390 | return false; | 371 | return false; |
391 | } | 372 | } |
392 | struct sway_container_state *cstate = &node->sway_container->current; | 373 | struct sway_container_state *cstate = &node->sway_container->current; |
393 | struct sway_container_state *istate = instruction->container_state; | 374 | struct sway_container_state *istate = &instruction->container_state; |
394 | #ifdef HAVE_XWAYLAND | 375 | #ifdef HAVE_XWAYLAND |
395 | // Xwayland views are position-aware and need to be reconfigured | 376 | // Xwayland views are position-aware and need to be reconfigured |
396 | // when their position changes. | 377 | // when their position changes. |
@@ -418,10 +399,10 @@ static void transaction_commit(struct sway_transaction *transaction) { | |||
418 | struct sway_node *node = instruction->node; | 399 | struct sway_node *node = instruction->node; |
419 | if (should_configure(node, instruction)) { | 400 | if (should_configure(node, instruction)) { |
420 | instruction->serial = view_configure(node->sway_container->view, | 401 | instruction->serial = view_configure(node->sway_container->view, |
421 | instruction->container_state->view_x, | 402 | instruction->container_state.view_x, |
422 | instruction->container_state->view_y, | 403 | instruction->container_state.view_y, |
423 | instruction->container_state->view_width, | 404 | instruction->container_state.view_width, |
424 | instruction->container_state->view_height); | 405 | instruction->container_state.view_height); |
425 | ++transaction->num_waiting; | 406 | ++transaction->num_waiting; |
426 | 407 | ||
427 | // From here on we are rendering a saved buffer of the view, which | 408 | // From here on we are rendering a saved buffer of the view, which |
@@ -513,8 +494,8 @@ void transaction_notify_view_ready_by_size(struct sway_view *view, | |||
513 | int width, int height) { | 494 | int width, int height) { |
514 | struct sway_transaction_instruction *instruction = | 495 | struct sway_transaction_instruction *instruction = |
515 | view->container->node.instruction; | 496 | view->container->node.instruction; |
516 | if (instruction->container_state->view_width == width && | 497 | if (instruction->container_state.view_width == width && |
517 | instruction->container_state->view_height == height) { | 498 | instruction->container_state.view_height == height) { |
518 | set_instruction_ready(instruction); | 499 | set_instruction_ready(instruction); |
519 | } | 500 | } |
520 | } | 501 | } |
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index f696646f..f39fe29c 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -233,7 +233,8 @@ static void handle_new_input(struct wl_listener *listener, void *data) { | |||
233 | wlr_log(WLR_DEBUG, "adding device: '%s'", | 233 | wlr_log(WLR_DEBUG, "adding device: '%s'", |
234 | input_device->identifier); | 234 | input_device->identifier); |
235 | 235 | ||
236 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { | 236 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER || |
237 | input_device->wlr_device->type == WLR_INPUT_DEVICE_TABLET_TOOL) { | ||
237 | input_manager_libinput_config_pointer(input_device); | 238 | input_manager_libinput_config_pointer(input_device); |
238 | } | 239 | } |
239 | 240 | ||
@@ -393,7 +394,8 @@ void input_manager_apply_input_config(struct sway_input_manager *input, | |||
393 | wl_list_for_each(input_device, &input->devices, link) { | 394 | wl_list_for_each(input_device, &input->devices, link) { |
394 | if (strcmp(input_device->identifier, input_config->identifier) == 0 | 395 | if (strcmp(input_device->identifier, input_config->identifier) == 0 |
395 | || wildcard) { | 396 | || wildcard) { |
396 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { | 397 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER || |
398 | input_device->wlr_device->type == WLR_INPUT_DEVICE_TABLET_TOOL) { | ||
397 | input_manager_libinput_config_pointer(input_device); | 399 | input_manager_libinput_config_pointer(input_device); |
398 | } | 400 | } |
399 | 401 | ||
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 99959c97..2d915502 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -1,8 +1,5 @@ | |||
1 | // See https://i3wm.org/docs/ipc.html for protocol information | 1 | // See https://i3wm.org/docs/ipc.html for protocol information |
2 | #ifndef __FreeBSD__ | 2 | #define _POSIX_C_SOURCE 200112L |
3 | // Any value will hide SOCK_CLOEXEC on FreeBSD (__BSD_VISIBLE=0) | ||
4 | #define _XOPEN_SOURCE 700 | ||
5 | #endif | ||
6 | #ifdef __linux__ | 3 | #ifdef __linux__ |
7 | #include <linux/input-event-codes.h> | 4 | #include <linux/input-event-codes.h> |
8 | #elif __FreeBSD__ | 5 | #elif __FreeBSD__ |
@@ -89,10 +86,16 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { | |||
89 | } | 86 | } |
90 | 87 | ||
91 | void ipc_init(struct sway_server *server) { | 88 | void ipc_init(struct sway_server *server) { |
92 | ipc_socket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0); | 89 | ipc_socket = socket(AF_UNIX, SOCK_STREAM, 0); |
93 | if (ipc_socket == -1) { | 90 | if (ipc_socket == -1) { |
94 | sway_abort("Unable to create IPC socket"); | 91 | sway_abort("Unable to create IPC socket"); |
95 | } | 92 | } |
93 | if (fcntl(ipc_socket, F_SETFD, FD_CLOEXEC) == -1) { | ||
94 | sway_abort("Unable to set CLOEXEC on IPC socket"); | ||
95 | } | ||
96 | if (fcntl(ipc_socket, F_SETFL, O_NONBLOCK) == -1) { | ||
97 | sway_abort("Unable to set NONBLOCK on IPC socket"); | ||
98 | } | ||
96 | 99 | ||
97 | ipc_sockaddr = ipc_user_sockaddr(); | 100 | ipc_sockaddr = ipc_user_sockaddr(); |
98 | 101 | ||
diff --git a/sway/tree/view.c b/sway/tree/view.c index e370443c..a024f325 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -989,12 +989,16 @@ bool view_is_visible(struct sway_view *view) { | |||
989 | floater = floater->parent; | 989 | floater = floater->parent; |
990 | } | 990 | } |
991 | bool is_sticky = container_is_floating(floater) && floater->is_sticky; | 991 | bool is_sticky = container_is_floating(floater) && floater->is_sticky; |
992 | if (!is_sticky && !workspace_is_visible(workspace)) { | ||
993 | return false; | ||
994 | } | ||
992 | // Check view isn't in a tabbed or stacked container on an inactive tab | 995 | // Check view isn't in a tabbed or stacked container on an inactive tab |
993 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 996 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
994 | struct sway_container *con = view->container; | 997 | struct sway_container *con = view->container; |
995 | while (con) { | 998 | while (con) { |
996 | enum sway_container_layout layout = container_parent_layout(con); | 999 | enum sway_container_layout layout = container_parent_layout(con); |
997 | if (layout == L_TABBED || layout == L_STACKED) { | 1000 | if ((layout == L_TABBED || layout == L_STACKED) |
1001 | && !container_is_floating(con)) { | ||
998 | struct sway_node *parent = con->parent ? | 1002 | struct sway_node *parent = con->parent ? |
999 | &con->parent->node : &con->workspace->node; | 1003 | &con->parent->node : &con->workspace->node; |
1000 | if (seat_get_active_tiling_child(seat, parent) != &con->node) { | 1004 | if (seat_get_active_tiling_child(seat, parent) != &con->node) { |
@@ -1008,10 +1012,6 @@ bool view_is_visible(struct sway_view *view) { | |||
1008 | !container_is_fullscreen_or_child(view->container)) { | 1012 | !container_is_fullscreen_or_child(view->container)) { |
1009 | return false; | 1013 | return false; |
1010 | } | 1014 | } |
1011 | // Check the workspace is visible | ||
1012 | if (!is_sticky) { | ||
1013 | return workspace_is_visible(workspace); | ||
1014 | } | ||
1015 | return true; | 1015 | return true; |
1016 | } | 1016 | } |
1017 | 1017 | ||