diff options
-rw-r--r-- | sway/commands.c | 8 | ||||
-rw-r--r-- | sway/handlers.c | 28 |
2 files changed, 26 insertions, 10 deletions
diff --git a/sway/commands.c b/sway/commands.c index 742d6b86..20e0fc8d 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -286,6 +286,14 @@ static bool cmd_fullscreen(struct sway_config *config, int argc, char **argv) { | |||
286 | swayc_t *container = get_focused_container(&root_container); | 286 | swayc_t *container = get_focused_container(&root_container); |
287 | bool current = (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) > 0; | 287 | bool current = (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) > 0; |
288 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); | 288 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); |
289 | //Resize workspace if going from fullscreen -> notfullscreen | ||
290 | //otherwise just resize container | ||
291 | if (current) { | ||
292 | while (container->type != C_WORKSPACE) { | ||
293 | container = container->parent; | ||
294 | } | ||
295 | } | ||
296 | //Only resize container when going into fullscreen | ||
289 | arrange_windows(container, -1, -1); | 297 | arrange_windows(container, -1, -1); |
290 | 298 | ||
291 | return true; | 299 | return true; |
diff --git a/sway/handlers.c b/sway/handlers.c index f95683d0..b02cd988 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -82,16 +82,21 @@ static void handle_output_focused(wlc_handle output, bool focus) { | |||
82 | } | 82 | } |
83 | 83 | ||
84 | static bool handle_view_created(wlc_handle handle) { | 84 | static bool handle_view_created(wlc_handle handle) { |
85 | swayc_t *container = get_focused_container(&root_container); | 85 | swayc_t *focused = get_focused_container(&root_container); |
86 | swayc_t *view = new_view(container, handle); | 86 | swayc_t *view = new_view(focused, handle); |
87 | unfocus_all(&root_container); | ||
88 | if (view) { | 87 | if (view) { |
88 | unfocus_all(&root_container); | ||
89 | focus_view(view); | 89 | focus_view(view); |
90 | arrange_windows(view->parent, -1, -1); | 90 | arrange_windows(view->parent, -1, -1); |
91 | } else { //Unmanaged view | 91 | } else { //Unmanaged view |
92 | wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); | 92 | wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); |
93 | wlc_view_focus(handle); | 93 | wlc_view_focus(handle); |
94 | } | 94 | } |
95 | if (wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { | ||
96 | unfocus_all(&root_container); | ||
97 | focus_view(focused); | ||
98 | arrange_windows(focused, -1, -1); | ||
99 | } | ||
95 | return true; | 100 | return true; |
96 | } | 101 | } |
97 | 102 | ||
@@ -189,21 +194,24 @@ static bool handle_pointer_motion(wlc_handle view, uint32_t time, const struct w | |||
189 | if (!config->focus_follows_mouse) { | 194 | if (!config->focus_follows_mouse) { |
190 | return true; | 195 | return true; |
191 | } | 196 | } |
192 | swayc_t *c = find_container(&root_container, pointer_test, (void *)origin); | ||
193 | swayc_t *focused = get_focused_container(&root_container); | 197 | swayc_t *focused = get_focused_container(&root_container); |
194 | if (c && c != focused) { | 198 | if (!(wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN)) { |
195 | sway_log(L_DEBUG, "Switching focus to %p", c); | 199 | swayc_t *c = find_container(&root_container, pointer_test, (void *)origin); |
196 | unfocus_all(&root_container); | 200 | if (c && c != focused) { |
197 | focus_view(c); | 201 | sway_log(L_DEBUG, "Switching focus to %p", c); |
202 | unfocus_all(&root_container); | ||
203 | focus_view(c); | ||
204 | } | ||
198 | } | 205 | } |
199 | return true; | 206 | return true; |
200 | } | 207 | } |
201 | 208 | ||
202 | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, | 209 | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, |
203 | uint32_t button, enum wlc_button_state state) { | 210 | uint32_t button, enum wlc_button_state state) { |
204 | if (state == WLC_BUTTON_STATE_PRESSED) { | 211 | swayc_t *focused = get_focused_container(&root_container); |
212 | if (state == WLC_BUTTON_STATE_PRESSED | ||
213 | && !(wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN)) { | ||
205 | swayc_t *c = find_container(&root_container, pointer_test, &mouse_origin); | 214 | swayc_t *c = find_container(&root_container, pointer_test, &mouse_origin); |
206 | swayc_t *focused = get_focused_container(&root_container); | ||
207 | if (c && c != focused) { | 215 | if (c && c != focused) { |
208 | sway_log(L_DEBUG, "Switching focus to %p", c); | 216 | sway_log(L_DEBUG, "Switching focus to %p", c); |
209 | unfocus_all(&root_container); | 217 | unfocus_all(&root_container); |