diff options
-rw-r--r-- | sway/handlers.c | 9 | ||||
-rw-r--r-- | sway/handlers.h | 1 | ||||
-rw-r--r-- | sway/layout.c | 11 | ||||
-rw-r--r-- | sway/main.c | 3 |
4 files changed, 20 insertions, 4 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index f183c418..d2d8c5a0 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -27,6 +27,15 @@ void handle_output_resolution_change(wlc_handle output, const struct wlc_size *f | |||
27 | arrange_windows(&root_container, -1, -1); | 27 | arrange_windows(&root_container, -1, -1); |
28 | } | 28 | } |
29 | 29 | ||
30 | void handle_output_focused(wlc_handle output, bool focus) { | ||
31 | swayc_t *c = get_swayc_for_handle(output, &root_container); | ||
32 | if (!c) return; | ||
33 | if (focus) { | ||
34 | unfocus_all(&root_container); | ||
35 | focus_view(c); | ||
36 | } | ||
37 | } | ||
38 | |||
30 | bool handle_view_created(wlc_handle view) { | 39 | bool handle_view_created(wlc_handle view) { |
31 | add_view(view); | 40 | add_view(view); |
32 | return true; | 41 | return true; |
diff --git a/sway/handlers.h b/sway/handlers.h index 331be725..9792b6d7 100644 --- a/sway/handlers.h +++ b/sway/handlers.h | |||
@@ -7,6 +7,7 @@ | |||
7 | bool handle_output_created(wlc_handle output); | 7 | bool handle_output_created(wlc_handle output); |
8 | void handle_output_destroyed(wlc_handle output); | 8 | void handle_output_destroyed(wlc_handle output); |
9 | void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to); | 9 | void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to); |
10 | void handle_output_focused(wlc_handle output, bool focus); | ||
10 | 11 | ||
11 | bool handle_view_created(wlc_handle view); | 12 | bool handle_view_created(wlc_handle view); |
12 | void handle_view_destroyed(wlc_handle view); | 13 | void handle_view_destroyed(wlc_handle view); |
diff --git a/sway/layout.c b/sway/layout.c index 08d1952c..ccf29f34 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -44,10 +44,16 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
44 | sway_log(L_DEBUG, "Arranging output at %d", x); | 44 | sway_log(L_DEBUG, "Arranging output at %d", x); |
45 | child->x = x; | 45 | child->x = x; |
46 | child->y = y; | 46 | child->y = y; |
47 | arrange_windows(child, child->width, child->height); | 47 | arrange_windows(child, -1, -1); |
48 | x += child->width; | 48 | x += child->width; |
49 | } | 49 | } |
50 | return; | 50 | return; |
51 | case C_OUTPUT: | ||
52 | container->width = width; | ||
53 | container->height = height; | ||
54 | x -= container->x; | ||
55 | y -= container->y; | ||
56 | break; | ||
51 | case C_VIEW: | 57 | case C_VIEW: |
52 | { | 58 | { |
53 | struct wlc_geometry geometry = { | 59 | struct wlc_geometry geometry = { |
@@ -342,9 +348,8 @@ void add_output(wlc_handle output) { | |||
342 | add_child(container, workspace); | 348 | add_child(container, workspace); |
343 | sway_log(L_DEBUG, "Added workspace %s for output %d", workspace->name, output); | 349 | sway_log(L_DEBUG, "Added workspace %s for output %d", workspace->name, output); |
344 | 350 | ||
345 | workspace_switch(workspace); | ||
346 | |||
347 | if (root_container.focused == NULL) { | 351 | if (root_container.focused == NULL) { |
352 | workspace_switch(workspace); | ||
348 | unfocus_all(&root_container); | 353 | unfocus_all(&root_container); |
349 | focus_view(workspace); | 354 | focus_view(workspace); |
350 | } | 355 | } |
diff --git a/sway/main.c b/sway/main.c index af8c6ed1..f84451de 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -17,7 +17,8 @@ int main(int argc, char **argv) { | |||
17 | .output = { | 17 | .output = { |
18 | .created = handle_output_created, | 18 | .created = handle_output_created, |
19 | .destroyed = handle_output_destroyed, | 19 | .destroyed = handle_output_destroyed, |
20 | .resolution = handle_output_resolution_change | 20 | .resolution = handle_output_resolution_change, |
21 | .focus = handle_output_focused | ||
21 | }, | 22 | }, |
22 | .view = { | 23 | .view = { |
23 | .created = handle_view_created, | 24 | .created = handle_view_created, |