diff options
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 9944be33..af1fc98c 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -69,7 +69,7 @@ static void handle_output_destroyed(wlc_handle output) { | |||
69 | 69 | ||
70 | static void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to) { | 70 | static void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to) { |
71 | sway_log(L_DEBUG, "Output %d resolution changed to %d x %d", output, to->w, to->h); | 71 | sway_log(L_DEBUG, "Output %d resolution changed to %d x %d", output, to->w, to->h); |
72 | swayc_t *c = get_swayc_for_handle(output, &root_container); | 72 | swayc_t *c = wlc_handle_get_user_data(output); |
73 | if (!c) return; | 73 | if (!c) return; |
74 | c->width = to->w; | 74 | c->width = to->w; |
75 | c->height = to->h; | 75 | c->height = to->h; |
@@ -77,7 +77,7 @@ static void handle_output_resolution_change(wlc_handle output, const struct wlc_ | |||
77 | } | 77 | } |
78 | 78 | ||
79 | static void handle_output_focused(wlc_handle output, bool focus) { | 79 | static void handle_output_focused(wlc_handle output, bool focus) { |
80 | swayc_t *c = get_swayc_for_handle(output, &root_container); | 80 | swayc_t *c = wlc_handle_get_user_data(output); |
81 | if (!c) return; | 81 | if (!c) return; |
82 | if (focus) { | 82 | if (focus) { |
83 | unfocus_all(&root_container); | 83 | unfocus_all(&root_container); |
@@ -88,28 +88,28 @@ static void handle_output_focused(wlc_handle output, bool focus) { | |||
88 | static bool handle_view_created(wlc_handle handle) { | 88 | static bool handle_view_created(wlc_handle handle) { |
89 | swayc_t *focused = get_focused_container(&root_container); | 89 | swayc_t *focused = get_focused_container(&root_container); |
90 | swayc_t *view = new_view(focused, handle); | 90 | swayc_t *view = new_view(focused, handle); |
91 | //Leave unamanaged windows alone | ||
91 | if (view) { | 92 | if (view) { |
92 | //Set maximize flag for windows. | ||
93 | //TODO: floating windows have this unset | ||
94 | wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); | ||
95 | unfocus_all(&root_container); | ||
96 | focus_view(view); | ||
97 | arrange_windows(view->parent, -1, -1); | 93 | arrange_windows(view->parent, -1, -1); |
98 | } else { //Unmanaged view | 94 | wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); |
95 | if (!(wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN)) { | ||
96 | unfocus_all(&root_container); | ||
97 | focus_view(view); | ||
98 | } | ||
99 | else { | ||
100 | wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); | ||
101 | wlc_view_focus(handle); | ||
102 | } | ||
103 | } else { | ||
99 | wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); | 104 | wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); |
100 | wlc_view_focus(handle); | 105 | wlc_view_focus(handle); |
101 | } | 106 | } |
102 | if (wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { | ||
103 | unfocus_all(&root_container); | ||
104 | focus_view(focused); | ||
105 | arrange_windows(focused, -1, -1); | ||
106 | } | ||
107 | return true; | 107 | return true; |
108 | } | 108 | } |
109 | 109 | ||
110 | static void handle_view_destroyed(wlc_handle handle) { | 110 | static void handle_view_destroyed(wlc_handle handle) { |
111 | sway_log(L_DEBUG, "Destroying window %d", handle); | 111 | sway_log(L_DEBUG, "Destroying window %d", handle); |
112 | swayc_t *view = get_swayc_for_handle(handle, &root_container); | 112 | swayc_t *view = wlc_handle_get_user_data(handle); |
113 | swayc_t *parent; | 113 | swayc_t *parent; |
114 | swayc_t *focused = get_focused_container(&root_container); | 114 | swayc_t *focused = get_focused_container(&root_container); |
115 | 115 | ||