diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | include/container.h | 4 | ||||
-rw-r--r-- | include/input_state.h | 5 | ||||
-rw-r--r-- | include/ipc.h | 12 | ||||
-rw-r--r-- | include/layout.h | 4 | ||||
-rw-r--r-- | sway-xorg.desktop | 5 | ||||
-rw-r--r-- | sway.desktop | 5 | ||||
-rw-r--r-- | sway/commands.c | 154 | ||||
-rw-r--r-- | sway/config.c | 3 | ||||
-rw-r--r-- | sway/handlers.c | 134 | ||||
-rw-r--r-- | sway/input_state.c | 10 | ||||
-rw-r--r-- | sway/ipc.c | 4 | ||||
-rw-r--r-- | sway/layout.c | 52 | ||||
-rw-r--r-- | sway/log.c | 5 | ||||
-rw-r--r-- | sway/type | 113 |
15 files changed, 484 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d190cd8b..3ed6fc02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -69,3 +69,11 @@ INSTALL( | |||
69 | FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5 | 69 | FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5 |
70 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man5 | 70 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man5 |
71 | ) | 71 | ) |
72 | |||
73 | INSTALL( | ||
74 | FILES ${PROJECT_SOURCE_DIR}/sway.desktop | ||
75 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/wayland-sessions/) | ||
76 | |||
77 | INSTALL( | ||
78 | FILES ${PROJECT_SOURCE_DIR}/sway-xorg.desktop | ||
79 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/xsessions/) | ||
diff --git a/include/container.h b/include/container.h index 79e023fe..4e21461c 100644 --- a/include/container.h +++ b/include/container.h | |||
@@ -34,12 +34,12 @@ struct sway_container { | |||
34 | enum swayc_layouts layout; | 34 | enum swayc_layouts layout; |
35 | 35 | ||
36 | // Not including borders or margins | 36 | // Not including borders or margins |
37 | int width, height; | 37 | double width, height; |
38 | 38 | ||
39 | // Used for setting floating geometry | 39 | // Used for setting floating geometry |
40 | int desired_width, desired_height; | 40 | int desired_width, desired_height; |
41 | 41 | ||
42 | int x, y; | 42 | double x, y; |
43 | 43 | ||
44 | bool visible; | 44 | bool visible; |
45 | bool is_floating; | 45 | bool is_floating; |
diff --git a/include/input_state.h b/include/input_state.h index 782b4b19..27dd6cff 100644 --- a/include/input_state.h +++ b/include/input_state.h | |||
@@ -34,6 +34,10 @@ extern struct pointer_state { | |||
34 | bool drag; | 34 | bool drag; |
35 | bool resize; | 35 | bool resize; |
36 | } floating; | 36 | } floating; |
37 | struct pointer_tiling { | ||
38 | bool resize; | ||
39 | swayc_t *init_view; | ||
40 | } tiling; | ||
37 | struct pointer_lock { | 41 | struct pointer_lock { |
38 | bool left; | 42 | bool left; |
39 | bool right; | 43 | bool right; |
@@ -44,6 +48,7 @@ extern struct pointer_state { | |||
44 | 48 | ||
45 | void start_floating(swayc_t *view); | 49 | void start_floating(swayc_t *view); |
46 | void reset_floating(swayc_t *view); | 50 | void reset_floating(swayc_t *view); |
51 | void input_init(void); | ||
47 | 52 | ||
48 | #endif | 53 | #endif |
49 | 54 | ||
diff --git a/include/ipc.h b/include/ipc.h index 0b6441f6..2d71c666 100644 --- a/include/ipc.h +++ b/include/ipc.h | |||
@@ -2,14 +2,14 @@ | |||
2 | #define _SWAY_IPC_H | 2 | #define _SWAY_IPC_H |
3 | 3 | ||
4 | enum ipc_command_type { | 4 | enum ipc_command_type { |
5 | IPC_COMMAND = 0, | 5 | IPC_COMMAND = 0, |
6 | IPC_GET_WORKSPACES = 1, | 6 | IPC_GET_WORKSPACES = 1, |
7 | IPC_SUBSCRIBE = 2, | 7 | IPC_SUBSCRIBE = 2, |
8 | IPC_GET_OUTPUTS = 3, | 8 | IPC_GET_OUTPUTS = 3, |
9 | IPC_GET_TREE = 4, | 9 | IPC_GET_TREE = 4, |
10 | IPC_GET_MARKS = 5, | 10 | IPC_GET_MARKS = 5, |
11 | IPC_GET_BAR_CONFIG = 6, | 11 | IPC_GET_BAR_CONFIG = 6, |
12 | IPC_GET_VERSION = 7, | 12 | IPC_GET_VERSION = 7, |
13 | }; | 13 | }; |
14 | 14 | ||
15 | void ipc_init(void); | 15 | void ipc_init(void); |
diff --git a/include/layout.h b/include/layout.h index 5c73af99..55bb6709 100644 --- a/include/layout.h +++ b/include/layout.h | |||
@@ -21,7 +21,7 @@ void move_container(swayc_t* container,swayc_t* root,enum movement_direction dir | |||
21 | 21 | ||
22 | 22 | ||
23 | // Layout | 23 | // Layout |
24 | void arrange_windows(swayc_t *container, int width, int height); | 24 | void arrange_windows(swayc_t *container, double width, double height); |
25 | 25 | ||
26 | // Focus | 26 | // Focus |
27 | void unfocus_all(swayc_t *container); | 27 | void unfocus_all(swayc_t *container); |
@@ -32,4 +32,6 @@ swayc_t *get_focused_container(swayc_t *parent); | |||
32 | swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent); | 32 | swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent); |
33 | swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir); | 33 | swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir); |
34 | 34 | ||
35 | void recursive_resize(swayc_t *container, double amount, enum wlc_resize_edge edge); | ||
36 | |||
35 | #endif | 37 | #endif |
diff --git a/sway-xorg.desktop b/sway-xorg.desktop new file mode 100644 index 00000000..e93a4284 --- /dev/null +++ b/sway-xorg.desktop | |||
@@ -0,0 +1,5 @@ | |||
1 | [Desktop Entry] | ||
2 | Name=Sway (Xorg) | ||
3 | Comment=SirCmpwn's Wayland window manager | ||
4 | Exec=sway | ||
5 | Type=Application | ||
diff --git a/sway.desktop b/sway.desktop new file mode 100644 index 00000000..98c9af29 --- /dev/null +++ b/sway.desktop | |||
@@ -0,0 +1,5 @@ | |||
1 | [Desktop Entry] | ||
2 | Name=Sway | ||
3 | Comment=SirCmpwn's Wayland window manager | ||
4 | Exec=sway | ||
5 | Type=Application | ||
diff --git a/sway/commands.c b/sway/commands.c index af4cd56f..cb96703e 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -442,6 +442,159 @@ static bool cmd_reload(struct sway_config *config, int argc, char **argv) { | |||
442 | return true; | 442 | return true; |
443 | } | 443 | } |
444 | 444 | ||
445 | static bool cmd_resize(struct sway_config *config, int argc, char **argv) { | ||
446 | if (!checkarg(argc, "resize", EXPECTED_AT_LEAST, 3)) { | ||
447 | return false; | ||
448 | } | ||
449 | char *end; | ||
450 | int amount = (int)strtol(argv[2], &end, 10); | ||
451 | if (errno == ERANGE || amount == 0) { | ||
452 | errno = 0; | ||
453 | return false; | ||
454 | } | ||
455 | if (strcmp(argv[0], "shrink") != 0 && strcmp(argv[0], "grow") != 0) { | ||
456 | return false; | ||
457 | } | ||
458 | if (strcmp(argv[0], "shrink") == 0) { | ||
459 | amount *= -1; | ||
460 | } | ||
461 | |||
462 | swayc_t *parent = get_focused_view(active_workspace); | ||
463 | swayc_t *focused = parent; | ||
464 | swayc_t *sibling; | ||
465 | if (!parent) { | ||
466 | return true; | ||
467 | } | ||
468 | // Find the closest parent container which has siblings of the proper layout. | ||
469 | // Then apply the resize to all of them. | ||
470 | int i; | ||
471 | if (strcmp(argv[1], "width") == 0) { | ||
472 | int lnumber = 0; | ||
473 | int rnumber = 0; | ||
474 | while (parent->parent) { | ||
475 | if (parent->parent->layout == L_HORIZ) { | ||
476 | for (i = 0; i < parent->parent->children->length; i++) { | ||
477 | sibling = parent->parent->children->items[i]; | ||
478 | if (sibling->x != focused->x) { | ||
479 | if (sibling->x < parent->x) { | ||
480 | lnumber++; | ||
481 | } else if (sibling->x > parent->x) { | ||
482 | rnumber++; | ||
483 | } | ||
484 | } | ||
485 | } | ||
486 | if (rnumber || lnumber) { | ||
487 | break; | ||
488 | } | ||
489 | } | ||
490 | parent = parent->parent; | ||
491 | } | ||
492 | if (parent == &root_container) { | ||
493 | return true; | ||
494 | } | ||
495 | sway_log(L_DEBUG, "Found the proper parent: %p. It has %d l conts, and %d r conts", parent->parent, lnumber, rnumber); | ||
496 | //TODO: Ensure rounding is done in such a way that there are NO pixel leaks | ||
497 | for (i = 0; i < parent->parent->children->length; i++) { | ||
498 | sibling = parent->parent->children->items[i]; | ||
499 | if (sibling->x != focused->x) { | ||
500 | if (sibling->x < parent->x) { | ||
501 | double pixels = -1 * amount; | ||
502 | pixels /= lnumber; | ||
503 | if (rnumber) { | ||
504 | recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_RIGHT); | ||
505 | } else { | ||
506 | recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_RIGHT); | ||
507 | } | ||
508 | } else if (sibling->x > parent->x) { | ||
509 | double pixels = -1 * amount; | ||
510 | pixels /= rnumber; | ||
511 | if (lnumber) { | ||
512 | recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_LEFT); | ||
513 | } else { | ||
514 | recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_LEFT); | ||
515 | } | ||
516 | } | ||
517 | } else { | ||
518 | if (rnumber != 0 && lnumber != 0) { | ||
519 | double pixels = amount; | ||
520 | pixels /= 2; | ||
521 | recursive_resize(parent, pixels, WLC_RESIZE_EDGE_LEFT); | ||
522 | recursive_resize(parent, pixels, WLC_RESIZE_EDGE_RIGHT); | ||
523 | } else if (rnumber) { | ||
524 | recursive_resize(parent, amount, WLC_RESIZE_EDGE_RIGHT); | ||
525 | } else if (lnumber) { | ||
526 | recursive_resize(parent, amount, WLC_RESIZE_EDGE_LEFT); | ||
527 | } | ||
528 | } | ||
529 | } | ||
530 | // Recursive resize does not handle positions, let arrange_windows | ||
531 | // take care of that. | ||
532 | arrange_windows(active_workspace, -1, -1); | ||
533 | return true; | ||
534 | } else if (strcmp(argv[1], "height") == 0) { | ||
535 | int tnumber = 0; | ||
536 | int bnumber = 0; | ||
537 | while (parent->parent) { | ||
538 | if (parent->parent->layout == L_VERT) { | ||
539 | for (i = 0; i < parent->parent->children->length; i++) { | ||
540 | sibling = parent->parent->children->items[i]; | ||
541 | if (sibling->y != focused->y) { | ||
542 | if (sibling->y < parent->y) { | ||
543 | bnumber++; | ||
544 | } else if (sibling->y > parent->y) { | ||
545 | tnumber++; | ||
546 | } | ||
547 | } | ||
548 | } | ||
549 | if (bnumber || tnumber) { | ||
550 | break; | ||
551 | } | ||
552 | } | ||
553 | parent = parent->parent; | ||
554 | } | ||
555 | if (parent == &root_container) { | ||
556 | return true; | ||
557 | } | ||
558 | sway_log(L_DEBUG, "Found the proper parent: %p. It has %d b conts, and %d t conts", parent->parent, bnumber, tnumber); | ||
559 | //TODO: Ensure rounding is done in such a way that there are NO pixel leaks | ||
560 | for (i = 0; i < parent->parent->children->length; i++) { | ||
561 | sibling = parent->parent->children->items[i]; | ||
562 | if (sibling->y != focused->y) { | ||
563 | if (sibling->y < parent->y) { | ||
564 | double pixels = -1 * amount; | ||
565 | pixels /= bnumber; | ||
566 | if (tnumber) { | ||
567 | recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_BOTTOM); | ||
568 | } else { | ||
569 | recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_BOTTOM); | ||
570 | } | ||
571 | } else if (sibling->x > parent->x) { | ||
572 | double pixels = -1 * amount; | ||
573 | pixels /= tnumber; | ||
574 | if (bnumber) { | ||
575 | recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_TOP); | ||
576 | } else { | ||
577 | recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_TOP); | ||
578 | } | ||
579 | } | ||
580 | } else { | ||
581 | if (bnumber != 0 && tnumber != 0) { | ||
582 | double pixels = amount/2; | ||
583 | recursive_resize(parent, pixels, WLC_RESIZE_EDGE_TOP); | ||
584 | recursive_resize(parent, pixels, WLC_RESIZE_EDGE_BOTTOM); | ||
585 | } else if (tnumber) { | ||
586 | recursive_resize(parent, amount, WLC_RESIZE_EDGE_TOP); | ||
587 | } else if (bnumber) { | ||
588 | recursive_resize(parent, amount, WLC_RESIZE_EDGE_BOTTOM); | ||
589 | } | ||
590 | } | ||
591 | } | ||
592 | arrange_windows(active_workspace, -1, -1); | ||
593 | return true; | ||
594 | } | ||
595 | return true; | ||
596 | } | ||
597 | |||
445 | static bool cmd_set(struct sway_config *config, int argc, char **argv) { | 598 | static bool cmd_set(struct sway_config *config, int argc, char **argv) { |
446 | if (!checkarg(argc, "set", EXPECTED_EQUAL_TO, 2)) { | 599 | if (!checkarg(argc, "set", EXPECTED_EQUAL_TO, 2)) { |
447 | return false; | 600 | return false; |
@@ -606,6 +759,7 @@ static struct cmd_handler handlers[] = { | |||
606 | { "log_colors", cmd_log_colors }, | 759 | { "log_colors", cmd_log_colors }, |
607 | { "move", cmd_move}, | 760 | { "move", cmd_move}, |
608 | { "reload", cmd_reload }, | 761 | { "reload", cmd_reload }, |
762 | { "resize", cmd_resize }, | ||
609 | { "set", cmd_set }, | 763 | { "set", cmd_set }, |
610 | { "split", cmd_split }, | 764 | { "split", cmd_split }, |
611 | { "splith", cmd_splith }, | 765 | { "splith", cmd_splith }, |
diff --git a/sway/config.c b/sway/config.c index 9f65e8a2..0afb0205 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "commands.h" | 9 | #include "commands.h" |
10 | #include "config.h" | 10 | #include "config.h" |
11 | #include "layout.h" | 11 | #include "layout.h" |
12 | #include "input_state.h" | ||
12 | 13 | ||
13 | struct sway_config *config; | 14 | struct sway_config *config; |
14 | 15 | ||
@@ -147,6 +148,8 @@ _continue: | |||
147 | bool load_config(const char *file) { | 148 | bool load_config(const char *file) { |
148 | sway_log(L_INFO, "Loading config"); | 149 | sway_log(L_INFO, "Loading config"); |
149 | 150 | ||
151 | input_init(); | ||
152 | |||
150 | char *path; | 153 | char *path; |
151 | if (file != NULL) { | 154 | if (file != NULL) { |
152 | path = strdup(file); | 155 | path = strdup(file); |
diff --git a/sway/handlers.c b/sway/handlers.c index 79628fe5..53eae439 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <xkbcommon/xkbcommon.h> | 1 | #include <xkbcommon/xkbcommon.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <math.h> | ||
4 | #include <wlc/wlc.h> | 5 | #include <wlc/wlc.h> |
5 | #include <ctype.h> | 6 | #include <ctype.h> |
6 | 7 | ||
@@ -338,11 +339,14 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
338 | static wlc_handle prev_handle = 0; | 339 | static wlc_handle prev_handle = 0; |
339 | mouse_origin = *origin; | 340 | mouse_origin = *origin; |
340 | bool changed_floating = false; | 341 | bool changed_floating = false; |
342 | bool changed_tiling = false; | ||
343 | int min_sane_w = 100; | ||
344 | int min_sane_h = 60; | ||
341 | if (!active_workspace) { | 345 | if (!active_workspace) { |
342 | return false; | 346 | return false; |
343 | } | 347 | } |
344 | // Do checks to determine if proper keys are being held | 348 | // Do checks to determine if proper keys are being held |
345 | swayc_t *view = get_focused_view(active_workspace); | 349 | swayc_t *view = container_under_pointer(); |
346 | uint32_t edge = 0; | 350 | uint32_t edge = 0; |
347 | if (pointer_state.floating.drag && view) { | 351 | if (pointer_state.floating.drag && view) { |
348 | if (view->is_floating) { | 352 | if (view->is_floating) { |
@@ -356,8 +360,6 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
356 | if (view->is_floating) { | 360 | if (view->is_floating) { |
357 | int dx = mouse_origin.x - prev_pos.x; | 361 | int dx = mouse_origin.x - prev_pos.x; |
358 | int dy = mouse_origin.y - prev_pos.y; | 362 | int dy = mouse_origin.y - prev_pos.y; |
359 | int min_sane_w = 100; | ||
360 | int min_sane_h = 60; | ||
361 | 363 | ||
362 | // Move and resize the view based on the dx/dy and mouse position | 364 | // Move and resize the view based on the dx/dy and mouse position |
363 | int midway_x = view->x + view->width/2; | 365 | int midway_x = view->x + view->width/2; |
@@ -417,6 +419,106 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
417 | } | 419 | } |
418 | } | 420 | } |
419 | } | 421 | } |
422 | } | ||
423 | } else if (pointer_state.tiling.resize && view) { | ||
424 | if (view != pointer_state.tiling.init_view) { | ||
425 | // Quit out of the resize | ||
426 | pointer_state.tiling.init_view = NULL; | ||
427 | } | ||
428 | if (!view->is_floating && view == pointer_state.tiling.init_view) { | ||
429 | // Handle layout resizes -- Find the biggest parent container then apply resizes to that | ||
430 | // and its bordering siblings | ||
431 | swayc_t *parent = view; | ||
432 | double dx = mouse_origin.x - prev_pos.x; | ||
433 | double dy = mouse_origin.y - prev_pos.y; | ||
434 | if (pointer_state.lock.top) { | ||
435 | while (parent->type != C_WORKSPACE) { | ||
436 | // TODO: Absolute value is a bad hack here to compensate for rounding. Find a better | ||
437 | // way of doing this. | ||
438 | if (fabs(parent->parent->y + parent->parent->height - (view->y + view->height)) <= 1) { | ||
439 | parent = parent->parent; | ||
440 | } else { | ||
441 | break; | ||
442 | } | ||
443 | } | ||
444 | if (parent->parent->children->length > 1 && parent->parent->layout == L_VERT) { | ||
445 | sway_log(L_DEBUG, "Top is locked, found biggest valid parent at: %p", parent); | ||
446 | swayc_t *sibling = get_swayc_in_direction(parent, MOVE_DOWN); | ||
447 | if (sibling) { | ||
448 | sway_log(L_DEBUG, "Found sibling at: %p", sibling); | ||
449 | if ((parent->height > min_sane_h || dy > 0) && (sibling->height > min_sane_h || dy < 0)) { | ||
450 | recursive_resize(parent, dy, WLC_RESIZE_EDGE_BOTTOM); | ||
451 | recursive_resize(sibling, -1 * dy, WLC_RESIZE_EDGE_TOP); | ||
452 | changed_tiling = true; | ||
453 | } | ||
454 | } | ||
455 | } | ||
456 | } else { | ||
457 | while (parent->type != C_WORKSPACE) { | ||
458 | if (fabs(parent->parent->y - view->y) <= 1) { | ||
459 | parent = parent->parent; | ||
460 | } else { | ||
461 | break; | ||
462 | } | ||
463 | } | ||
464 | if (parent->parent->children->length > 1 && parent->parent->layout == L_VERT) { | ||
465 | sway_log(L_DEBUG, "Bot is locked, found biggest valid parent at: %p", parent); | ||
466 | swayc_t *sibling = get_swayc_in_direction(parent, MOVE_UP); | ||
467 | if (sibling) { | ||
468 | sway_log(L_DEBUG, "Found sibling at: %p", sibling); | ||
469 | if ((parent->height > min_sane_h || dy < 0) && (sibling->height > min_sane_h || dy > 0)) { | ||
470 | recursive_resize(parent, -1 * dy, WLC_RESIZE_EDGE_TOP); | ||
471 | recursive_resize(sibling, dy, WLC_RESIZE_EDGE_BOTTOM); | ||
472 | changed_tiling = true; | ||
473 | } | ||
474 | } | ||
475 | } | ||
476 | } | ||
477 | |||
478 | parent = view; | ||
479 | if (pointer_state.lock.left) { | ||
480 | while (parent->type != C_WORKSPACE) { | ||
481 | if (fabs(parent->parent->x + parent->parent->width - (view->x + view->width)) <= 1) { | ||
482 | parent = parent->parent; | ||
483 | } else { | ||
484 | sway_log(L_DEBUG, "view: %f vs parent: %f", view->x + view->width, parent->parent->x + parent->parent->width); | ||
485 | break; | ||
486 | } | ||
487 | } | ||
488 | if (parent->parent->children->length > 1 && parent->parent->layout == L_HORIZ) { | ||
489 | sway_log(L_DEBUG, "Left is locked, found biggest valid parent at: %p", parent); | ||
490 | swayc_t *sibling = get_swayc_in_direction(parent, MOVE_RIGHT); | ||
491 | if (sibling) { | ||
492 | sway_log(L_DEBUG, "Found sibling at: %p", sibling); | ||
493 | if ((parent->width > min_sane_w || dx > 0) && (sibling->width > min_sane_w || dx < 0)) { | ||
494 | recursive_resize(parent, dx, WLC_RESIZE_EDGE_RIGHT); | ||
495 | recursive_resize(sibling, -1 * dx, WLC_RESIZE_EDGE_LEFT); | ||
496 | changed_tiling = true; | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | } else { | ||
501 | while (parent->type != C_WORKSPACE) { | ||
502 | if (fabs(parent->parent->x - view->x) <= 1 && parent->parent) { | ||
503 | parent = parent->parent; | ||
504 | } else { | ||
505 | break; | ||
506 | } | ||
507 | } | ||
508 | if (parent->parent->children->length > 1 && parent->parent->layout == L_HORIZ) { | ||
509 | sway_log(L_DEBUG, "Right is locked, found biggest valid parent at: %p", parent); | ||
510 | swayc_t *sibling = get_swayc_in_direction(parent, MOVE_LEFT); | ||
511 | if (sibling) { | ||
512 | sway_log(L_DEBUG, "Found sibling at: %p", sibling); | ||
513 | if ((parent->width > min_sane_w || dx < 0) && (sibling->width > min_sane_w || dx > 0)) { | ||
514 | recursive_resize(parent, -1 * dx, WLC_RESIZE_EDGE_LEFT); | ||
515 | recursive_resize(sibling, dx, WLC_RESIZE_EDGE_RIGHT); | ||
516 | changed_tiling = true; | ||
517 | } | ||
518 | } | ||
519 | } | ||
520 | } | ||
521 | arrange_windows(active_workspace, -1, -1); | ||
420 | } | 522 | } |
421 | } | 523 | } |
422 | if (config->focus_follows_mouse && prev_handle != handle) { | 524 | if (config->focus_follows_mouse && prev_handle != handle) { |
@@ -443,6 +545,9 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
443 | wlc_view_set_geometry(view->handle, edge, &geometry); | 545 | wlc_view_set_geometry(view->handle, edge, &geometry); |
444 | return true; | 546 | return true; |
445 | } | 547 | } |
548 | if (changed_tiling) { | ||
549 | return true; | ||
550 | } | ||
446 | return false; | 551 | return false; |
447 | } | 552 | } |
448 | 553 | ||
@@ -463,7 +568,16 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
463 | pointer_state.r_held = true; | 568 | pointer_state.r_held = true; |
464 | } | 569 | } |
465 | swayc_t *pointer = container_under_pointer(); | 570 | swayc_t *pointer = container_under_pointer(); |
466 | set_focused_container(pointer); | 571 | if (pointer) { |
572 | set_focused_container(pointer); | ||
573 | int midway_x = pointer->x + pointer->width/2; | ||
574 | int midway_y = pointer->y + pointer->height/2; | ||
575 | pointer_state.lock.bottom = origin->y < midway_y; | ||
576 | pointer_state.lock.top = !pointer_state.lock.bottom; | ||
577 | pointer_state.lock.right = origin->x < midway_x; | ||
578 | pointer_state.lock.left = !pointer_state.lock.right; | ||
579 | } | ||
580 | |||
467 | if (pointer->is_floating) { | 581 | if (pointer->is_floating) { |
468 | int i; | 582 | int i; |
469 | for (i = 0; i < pointer->parent->floating->length; i++) { | 583 | for (i = 0; i < pointer->parent->floating->length; i++) { |
@@ -475,19 +589,15 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
475 | } | 589 | } |
476 | arrange_windows(pointer->parent, -1, -1); | 590 | arrange_windows(pointer->parent, -1, -1); |
477 | if (modifiers->mods & config->floating_mod) { | 591 | if (modifiers->mods & config->floating_mod) { |
478 | int midway_x = pointer->x + pointer->width/2; | ||
479 | int midway_y = pointer->y + pointer->height/2; | ||
480 | |||
481 | pointer_state.floating.drag = pointer_state.l_held; | 592 | pointer_state.floating.drag = pointer_state.l_held; |
482 | pointer_state.floating.resize = pointer_state.r_held; | 593 | pointer_state.floating.resize = pointer_state.r_held; |
483 | pointer_state.lock.bottom = origin->y < midway_y; | ||
484 | pointer_state.lock.top = !pointer_state.lock.bottom; | ||
485 | pointer_state.lock.right = origin->x < midway_x; | ||
486 | pointer_state.lock.left = !pointer_state.lock.right; | ||
487 | start_floating(pointer); | 594 | start_floating(pointer); |
488 | } | 595 | } |
489 | // Dont want pointer sent to window while dragging or resizing | 596 | // Dont want pointer sent to window while dragging or resizing |
490 | return (pointer_state.floating.drag || pointer_state.floating.resize); | 597 | return (pointer_state.floating.drag || pointer_state.floating.resize); |
598 | } else { | ||
599 | pointer_state.tiling.resize = pointer_state.r_held; | ||
600 | pointer_state.tiling.init_view = pointer; | ||
491 | } | 601 | } |
492 | return (pointer && pointer != focused); | 602 | return (pointer && pointer != focused); |
493 | } else { | 603 | } else { |
@@ -499,6 +609,8 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
499 | if (button == M_RIGHT_CLICK) { | 609 | if (button == M_RIGHT_CLICK) { |
500 | pointer_state.r_held = false; | 610 | pointer_state.r_held = false; |
501 | pointer_state.floating.resize = false; | 611 | pointer_state.floating.resize = false; |
612 | pointer_state.tiling.resize = false; | ||
613 | pointer_state.tiling.init_view = NULL; | ||
502 | pointer_state.lock = (struct pointer_lock){false ,false ,false ,false}; | 614 | pointer_state.lock = (struct pointer_lock){false ,false ,false ,false}; |
503 | } | 615 | } |
504 | } | 616 | } |
diff --git a/sway/input_state.c b/sway/input_state.c index a7f88d4a..ef5d6df0 100644 --- a/sway/input_state.c +++ b/sway/input_state.c | |||
@@ -8,6 +8,13 @@ | |||
8 | 8 | ||
9 | static keycode key_state_array[KEY_STATE_MAX_LENGTH]; | 9 | static keycode key_state_array[KEY_STATE_MAX_LENGTH]; |
10 | 10 | ||
11 | void input_init(void) { | ||
12 | int i; | ||
13 | for (i = 0; i < KEY_STATE_MAX_LENGTH; ++i) { | ||
14 | key_state_array[i] = 0; | ||
15 | } | ||
16 | } | ||
17 | |||
11 | static uint8_t find_key(keycode key) { | 18 | static uint8_t find_key(keycode key) { |
12 | int i; | 19 | int i; |
13 | for (i = 0; i < KEY_STATE_MAX_LENGTH; ++i) { | 20 | for (i = 0; i < KEY_STATE_MAX_LENGTH; ++i) { |
@@ -41,7 +48,7 @@ void release_key(keycode key) { | |||
41 | } | 48 | } |
42 | } | 49 | } |
43 | 50 | ||
44 | struct pointer_state pointer_state = {0, 0, {0, 0}, {0, 0, 0, 0}}; | 51 | struct pointer_state pointer_state = {0, 0, {0, 0}, {0}, {0, 0, 0, 0}}; |
45 | 52 | ||
46 | static struct wlc_geometry saved_floating; | 53 | static struct wlc_geometry saved_floating; |
47 | 54 | ||
@@ -65,4 +72,3 @@ void reset_floating(swayc_t *view) { | |||
65 | pointer_state.floating = (struct pointer_floating){0,0}; | 72 | pointer_state.floating = (struct pointer_floating){0,0}; |
66 | pointer_state.lock = (struct pointer_lock){0,0,0,0}; | 73 | pointer_state.lock = (struct pointer_lock){0,0,0,0}; |
67 | } | 74 | } |
68 | |||
@@ -288,7 +288,7 @@ void ipc_get_workspaces_callback(swayc_t *container, void *data) { | |||
288 | "\"urgent\":%s" | 288 | "\"urgent\":%s" |
289 | "}", | 289 | "}", |
290 | num, container->name, container->visible ? "true" : "false", container->is_focused ? "true" : "false", | 290 | num, container->name, container->visible ? "true" : "false", container->is_focused ? "true" : "false", |
291 | container->x, container->y, container->width, container->height, | 291 | (int)container->x, (int)container->y, (int)container->width, (int)container->height, |
292 | container->parent->name, "false" // TODO: urgent hint | 292 | container->parent->name, "false" // TODO: urgent hint |
293 | ); | 293 | ); |
294 | list_add((list_t *)data, json); | 294 | list_add((list_t *)data, json); |
@@ -313,7 +313,7 @@ void ipc_get_outputs_callback(swayc_t *container, void *data) { | |||
313 | "\"current_workspace\":\"%s\"" | 313 | "\"current_workspace\":\"%s\"" |
314 | "}", | 314 | "}", |
315 | container->name, "true", "false", // TODO: active, primary | 315 | container->name, "true", "false", // TODO: active, primary |
316 | container->x, container->y, container->width, container->height, | 316 | (int)container->x, (int)container->y, (int)container->width, (int)container->height, |
317 | container->focused ? container->focused->name : "" | 317 | container->focused ? container->focused->name : "" |
318 | ); | 318 | ); |
319 | list_add((list_t *)data, json); | 319 | list_add((list_t *)data, json); |
diff --git a/sway/layout.c b/sway/layout.c index a7536727..7eaa9ea4 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -29,7 +29,7 @@ static int index_child(swayc_t *parent, swayc_t *child) { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | void add_child(swayc_t *parent, swayc_t *child) { | 31 | void add_child(swayc_t *parent, swayc_t *child) { |
32 | sway_log(L_DEBUG, "Adding %p (%d, %dx%d) to %p (%d, %dx%d)", child, child->type, | 32 | sway_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)", child, child->type, |
33 | child->width, child->height, parent, parent->type, parent->width, parent->height); | 33 | child->width, child->height, parent, parent->type, parent->width, parent->height); |
34 | list_add(parent->children, child); | 34 | list_add(parent->children, child); |
35 | child->parent = parent; | 35 | child->parent = parent; |
@@ -40,7 +40,7 @@ void add_child(swayc_t *parent, swayc_t *child) { | |||
40 | } | 40 | } |
41 | 41 | ||
42 | void add_floating(swayc_t *ws, swayc_t *child) { | 42 | void add_floating(swayc_t *ws, swayc_t *child) { |
43 | sway_log(L_DEBUG, "Adding %p (%d, %dx%d) to %p (%d, %dx%d)", child, child->type, | 43 | sway_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)", child, child->type, |
44 | child->width, child->height, ws, ws->type, ws->width, ws->height); | 44 | child->width, child->height, ws, ws->type, ws->width, ws->height); |
45 | list_add(ws->floating, child); | 45 | list_add(ws->floating, child); |
46 | child->parent = ws; | 46 | child->parent = ws; |
@@ -153,7 +153,7 @@ void move_container(swayc_t *container,swayc_t* root,enum movement_direction dir | |||
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
156 | void arrange_windows(swayc_t *container, int width, int height) { | 156 | void arrange_windows(swayc_t *container, double width, double height) { |
157 | int i; | 157 | int i; |
158 | if (width == -1 || height == -1) { | 158 | if (width == -1 || height == -1) { |
159 | sway_log(L_DEBUG, "Arranging layout for %p", container); | 159 | sway_log(L_DEBUG, "Arranging layout for %p", container); |
@@ -188,7 +188,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
188 | child->y = y + container->gaps; | 188 | child->y = y + container->gaps; |
189 | child->width = width - container->gaps * 2; | 189 | child->width = width - container->gaps * 2; |
190 | child->height = height - container->gaps * 2; | 190 | child->height = height - container->gaps * 2; |
191 | sway_log(L_DEBUG, "Arranging workspace #%d at %d, %d", i, child->x, child->y); | 191 | sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); |
192 | arrange_windows(child, -1, -1); | 192 | arrange_windows(child, -1, -1); |
193 | } | 193 | } |
194 | return; | 194 | return; |
@@ -234,7 +234,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
234 | default: | 234 | default: |
235 | // Calculate total width | 235 | // Calculate total width |
236 | for (i = 0; i < container->children->length; ++i) { | 236 | for (i = 0; i < container->children->length; ++i) { |
237 | int *old_width = &((swayc_t *)container->children->items[i])->width; | 237 | double *old_width = &((swayc_t *)container->children->items[i])->width; |
238 | if (*old_width <= 0) { | 238 | if (*old_width <= 0) { |
239 | if (container->children->length > 1) { | 239 | if (container->children->length > 1) { |
240 | *old_width = width / (container->children->length - 1); | 240 | *old_width = width / (container->children->length - 1); |
@@ -250,7 +250,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
250 | sway_log(L_DEBUG, "Arranging %p horizontally", container); | 250 | sway_log(L_DEBUG, "Arranging %p horizontally", container); |
251 | for (i = 0; i < container->children->length; ++i) { | 251 | for (i = 0; i < container->children->length; ++i) { |
252 | swayc_t *child = container->children->items[i]; | 252 | swayc_t *child = container->children->items[i]; |
253 | sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %d by %f)", child, child->type, width, scale); | 253 | sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, width, scale); |
254 | child->x = x + container->x; | 254 | child->x = x + container->x; |
255 | child->y = y + container->y; | 255 | child->y = y + container->y; |
256 | arrange_windows(child, child->width * scale, height); | 256 | arrange_windows(child, child->width * scale, height); |
@@ -261,7 +261,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
261 | case L_VERT: | 261 | case L_VERT: |
262 | // Calculate total height | 262 | // Calculate total height |
263 | for (i = 0; i < container->children->length; ++i) { | 263 | for (i = 0; i < container->children->length; ++i) { |
264 | int *old_height = &((swayc_t *)container->children->items[i])->height; | 264 | double *old_height = &((swayc_t *)container->children->items[i])->height; |
265 | if (*old_height <= 0) { | 265 | if (*old_height <= 0) { |
266 | if (container->children->length > 1) { | 266 | if (container->children->length > 1) { |
267 | *old_height = height / (container->children->length - 1); | 267 | *old_height = height / (container->children->length - 1); |
@@ -277,7 +277,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
277 | sway_log(L_DEBUG, "Arranging %p vertically", container); | 277 | sway_log(L_DEBUG, "Arranging %p vertically", container); |
278 | for (i = 0; i < container->children->length; ++i) { | 278 | for (i = 0; i < container->children->length; ++i) { |
279 | swayc_t *child = container->children->items[i]; | 279 | swayc_t *child = container->children->items[i]; |
280 | sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %d by %f)", child, child->type, height, scale); | 280 | sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, height, scale); |
281 | child->x = x + container->x; | 281 | child->x = x + container->x; |
282 | child->y = y + container->y; | 282 | child->y = y + container->y; |
283 | arrange_windows(child, width, child->height * scale); | 283 | arrange_windows(child, width, child->height * scale); |
@@ -408,3 +408,39 @@ swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) | |||
408 | } | 408 | } |
409 | } | 409 | } |
410 | } | 410 | } |
411 | |||
412 | void recursive_resize(swayc_t *container, double amount, enum wlc_resize_edge edge) { | ||
413 | int i; | ||
414 | bool layout_match = true; | ||
415 | sway_log(L_DEBUG, "Resizing %p with amount: %f", container, amount); | ||
416 | if (edge == WLC_RESIZE_EDGE_LEFT || edge == WLC_RESIZE_EDGE_RIGHT) { | ||
417 | container->width += amount; | ||
418 | layout_match = container->layout == L_HORIZ; | ||
419 | } else if (edge == WLC_RESIZE_EDGE_TOP || edge == WLC_RESIZE_EDGE_BOTTOM) { | ||
420 | container->height += amount; | ||
421 | layout_match = container->layout == L_VERT; | ||
422 | } | ||
423 | if (container->type == C_VIEW) { | ||
424 | struct wlc_geometry geometry = { | ||
425 | .origin = { | ||
426 | .x = container->x + container->gaps / 2, | ||
427 | .y = container->y + container->gaps / 2 | ||
428 | }, | ||
429 | .size = { | ||
430 | .w = container->width - container->gaps, | ||
431 | .h = container->height - container->gaps | ||
432 | } | ||
433 | }; | ||
434 | wlc_view_set_geometry(container->handle, edge, &geometry); | ||
435 | return; | ||
436 | } | ||
437 | if (layout_match) { | ||
438 | for (i = 0; i < container->children->length; i++) { | ||
439 | recursive_resize(container->children->items[i], amount/container->children->length, edge); | ||
440 | } | ||
441 | } else { | ||
442 | for (i = 0; i < container->children->length; i++) { | ||
443 | recursive_resize(container->children->items[i], amount, edge); | ||
444 | } | ||
445 | } | ||
446 | } | ||
@@ -142,13 +142,14 @@ static void container_log(const swayc_t *c) { | |||
142 | c->layout == L_STACKED ? "Stacked|": | 142 | c->layout == L_STACKED ? "Stacked|": |
143 | c->layout == L_FLOATING ? "Floating|": | 143 | c->layout == L_FLOATING ? "Floating|": |
144 | "Unknown|"); | 144 | "Unknown|"); |
145 | fprintf(stderr, "w:%d|h:%d|", c->width, c->height); | 145 | fprintf(stderr, "w:%f|h:%f|", c->width, c->height); |
146 | fprintf(stderr, "x:%d|y:%d|", c->x, c->y); | 146 | fprintf(stderr, "x:%f|y:%f|", c->x, c->y); |
147 | fprintf(stderr, "vis:%c|", c->visible?'t':'f'); | 147 | fprintf(stderr, "vis:%c|", c->visible?'t':'f'); |
148 | fprintf(stderr, "name:%.16s|", c->name); | 148 | fprintf(stderr, "name:%.16s|", c->name); |
149 | fprintf(stderr, "children:%d\n",c->children?c->children->length:0); | 149 | fprintf(stderr, "children:%d\n",c->children?c->children->length:0); |
150 | } | 150 | } |
151 | void layout_log(const swayc_t *c, int depth) { | 151 | void layout_log(const swayc_t *c, int depth) { |
152 | if (L_DEBUG > v) return; | ||
152 | int i, d; | 153 | int i, d; |
153 | int e = c->children ? c->children->length : 0; | 154 | int e = c->children ? c->children->length : 0; |
154 | container_log(c); | 155 | container_log(c); |
diff --git a/sway/type b/sway/type new file mode 100644 index 00000000..c7bebe5e --- /dev/null +++ b/sway/type | |||
@@ -0,0 +1,113 @@ | |||
1 | workspace.c:78:9: while (parent->type != C_OUTPUT) { | ||
2 | workspace.c:79:12: parent = parent->parent; | ||
3 | |||
4 | focus.c:16:6: if (parent->focused != c) { | ||
5 | focus.c:30:8: if (parent->focused) { | ||
6 | focus.c:31:19: swayc_t *ws = parent->focused; | ||
7 | focus.c:38:25: wlc_output_set_mask(parent->handle, 2); | ||
8 | focus.c:39:8: c->parent->focused = c; | ||
9 | focus.c:53:5: c->parent->focused = c; | ||
10 | focus.c:71:20: while (parent && !parent->is_focused) { | ||
11 | focus.c:72:12: parent = parent->focused; | ||
12 | focus.c:143:13: if (find->parent->focused != find) { | ||
13 | focus.c:167:19: while (parent && parent->type != C_VIEW) { | ||
14 | focus.c:168:7: if (parent->type == C_WORKSPACE && parent->focused == NULL) { | ||
15 | focus.c:171:12: parent = parent->focused; | ||
16 | |||
17 | handlers.c:24:9: while (parent->type != C_OUTPUT) { | ||
18 | handlers.c:25:12: parent = parent->parent; | ||
19 | handlers.c:436:18: while (parent->parent && parent->y + parent->height == view->y + view->height && parent->type != L_WORKSPACE) { | ||
20 | handlers.c:437:30: parent = parent->parent; | ||
21 | handlers.c:440:50: if (parent == &root_container || parent->children->length == 1) { | ||
22 | handlers.c:444:18: while (parent->parent && parent->y == view->y) { | ||
23 | handlers.c:445:30: parent = parent->parent; | ||
24 | handlers.c:448:50: if (parent == &root_container || parent->children->length == 1) { | ||
25 | handlers.c:454:18: while (parent->parent && parent->x + parent->width == view->x + view->width) { | ||
26 | handlers.c:455:30: parent = parent->parent; | ||
27 | handlers.c:458:50: if (parent == &root_container || parent->children->length == 1) { | ||
28 | handlers.c:462:18: while (parent->parent && parent->x + parent->width == view->x) { | ||
29 | handlers.c:463:30: parent = parent->parent; | ||
30 | handlers.c:466:50: if (parent == &root_container || parent->children->length == 1) { | ||
31 | handlers.c:528:29: for (i = 0; i < pointer->parent->floating->length; i++) { | ||
32 | handlers.c:529:18: if (pointer->parent->floating->items[i] == pointer) { | ||
33 | handlers.c:530:24: list_del(pointer->parent->floating, i); | ||
34 | handlers.c:531:24: list_add(pointer->parent->floating, pointer); | ||
35 | |||
36 | container.c:284:6: if (parent->type == C_CONTAINER) { | ||
37 | |||
38 | layout.c:23:18: for (i = 0; i < parent->children->length; ++i) { | ||
39 | layout.c:24:7: if (parent->children->items[i] == child) { | ||
40 | layout.c:33:40: child->width, child->height, parent, parent->type, parent->width, parent->height); | ||
41 | layout.c:34:11: list_add(parent->children, child); | ||
42 | layout.c:37:6: if (parent->children->length == 1) { | ||
43 | layout.c:56:11: if (i == parent->children->length) { | ||
44 | layout.c:59:14: list_insert(parent->children, i+1, child); | ||
45 | layout.c:70:2: parent->children->items[i] = new_child; | ||
46 | layout.c:73:13: if (child->parent->focused == child) { | ||
47 | layout.c:85:19: for (i = 0; i < parent->floating->length; ++i) { | ||
48 | layout.c:86:8: if (parent->floating->items[i] == child) { | ||
49 | layout.c:87:14: list_del(parent->floating, i); | ||
50 | layout.c:93:19: for (i = 0; i < parent->children->length; ++i) { | ||
51 | layout.c:94:8: if (parent->children->items[i] == child) { | ||
52 | layout.c:95:14: list_del(parent->children, i); | ||
53 | layout.c:101:6: if (parent->focused == child) { | ||
54 | layout.c:102:7: if (parent->children->length > 0) { | ||
55 | layout.c:103:38: set_focused_container_for(parent, parent->children->items[i?i-1:0]); | ||
56 | layout.c:105:4: parent->focused = NULL; | ||
57 | layout.c:165:12: while (parent->type != C_OUTPUT) { | ||
58 | layout.c:166:15: parent = parent->parent; | ||
59 | layout.c:170:23: geometry.size.w = parent->width; | ||
60 | layout.c:171:23: geometry.size.h = parent->height; | ||
61 | layout.c:267:13: while (parent->type != C_OUTPUT) { | ||
62 | layout.c:268:16: parent = parent->parent; | ||
63 | layout.c:272:24: geometry.size.w = parent->width; | ||
64 | layout.c:273:24: geometry.size.h = parent->height; | ||
65 | layout.c:294:6: if (parent->children == NULL) { | ||
66 | layout.c:300:6: if (parent->type == C_WORKSPACE) { | ||
67 | layout.c:301:19: for (i = 0; i < parent->floating->length; ++i) { | ||
68 | layout.c:302:21: swayc_t *child = parent->floating->items[i]; | ||
69 | layout.c:309:18: for (i = 0; i < parent->children->length; ++i) { | ||
70 | layout.c:310:20: swayc_t *child = parent->children->items[i]; | ||
71 | layout.c:327:7: if (parent->type == C_OUTPUT) { | ||
72 | layout.c:338:8: if (parent->layout == L_HORIZ || parent->type == C_ROOT) { | ||
73 | layout.c:343:8: if (parent->layout == L_VERT) { | ||
74 | layout.c:350:20: for (i = 0; i < parent->children->length; ++i) { | ||
75 | layout.c:351:22: swayc_t *child = parent->children->items[i]; | ||
76 | layout.c:357:34: if (desired < 0 || desired >= parent->children->length) { | ||
77 | layout.c:360:12: return parent->children->items[desired]; | ||
78 | layout.c:365:13: parent = parent->parent; | ||
79 | |||
80 | commands.c:394:9: while (parent->type == C_VIEW) { | ||
81 | commands.c:395:12: parent = parent->parent; | ||
82 | commands.c:399:3: parent->layout = L_HORIZ; | ||
83 | commands.c:401:3: parent->layout = L_VERT; | ||
84 | commands.c:403:7: if (parent->layout == L_VERT) { | ||
85 | commands.c:404:4: parent->layout = L_HORIZ; | ||
86 | commands.c:406:4: parent->layout = L_VERT; | ||
87 | commands.c:409:26: arrange_windows(parent, parent->width, parent->height); | ||
88 | commands.c:454:10: while (parent->parent) { | ||
89 | commands.c:455:8: if (parent->parent->layout == L_HORIZ) { | ||
90 | commands.c:456:21: for (i = 0; i < parent->parent->children->length; i++) { | ||
91 | commands.c:457:16: sibling = parent->parent->children->items[i]; | ||
92 | commands.c:459:24: if (sibling->x < parent->x) { | ||
93 | commands.c:461:31: } else if (sibling->x > parent->x) { | ||
94 | commands.c:470:13: parent = parent->parent; | ||
95 | commands.c:475:87: sway_log(L_DEBUG, "Found the proper parent: %p. It has %d l conts, and %d r conts", parent->parent, lnumber, rnumber); | ||
96 | commands.c:477:19: for (i = 0; i < parent->parent->children->length; i++) { | ||
97 | commands.c:478:14: sibling = parent->parent->children->items[i]; | ||
98 | commands.c:480:22: if (sibling->x < parent->x) { | ||
99 | commands.c:488:29: } else if (sibling->x > parent->x) { | ||
100 | commands.c:517:10: while (parent->parent) { | ||
101 | commands.c:518:8: if (parent->parent->layout == L_VERT) { | ||
102 | commands.c:519:21: for (i = 0; i < parent->parent->children->length; i++) { | ||
103 | commands.c:520:16: sibling = parent->parent->children->items[i]; | ||
104 | commands.c:522:24: if (sibling->y < parent->y) { | ||
105 | commands.c:524:31: } else if (sibling->y > parent->y) { | ||
106 | commands.c:533:13: parent = parent->parent; | ||
107 | commands.c:538:87: sway_log(L_DEBUG, "Found the proper parent: %p. It has %d b conts, and %d t conts", parent->parent, bnumber, tnumber); | ||
108 | commands.c:540:19: for (i = 0; i < parent->parent->children->length; i++) { | ||
109 | commands.c:541:14: sibling = parent->parent->children->items[i]; | ||
110 | commands.c:543:22: if (sibling->y < parent->y) { | ||
111 | commands.c:551:29: } else if (sibling->x > parent->x) { | ||
112 | commands.c:603:54: } else if (focused->type != C_WORKSPACE && focused->parent->children->length == 1) { | ||
113 | commands.c:606:12: focused->parent->layout = layout; | ||