Commit 0c51792c3b4909edcc797bec9f906a03b12522a4 Parent: 2e9b3d1167c2cf54e70006506cd3042ac6a0b7c2 Author: mcol <mcol@posteo.net> Date: 2021-01-31 20:15:06 +0000 Committer: mcol <mcol@posteo.net> Committed: 2021-01-31 20:15:06 +0000 unfullscreen when zooming/panning/focussing etc
src/shell.h Modified
@@ -10,6 +10,7 @@ void fullscreen_xdg_surface( struct view *view, struct wlr_xdg_surface *xdg_surface, struct wlr_output *output ); +void unfullscreen(); void set_up_shell(); #endif
src/shell.c Modified
@@ -113,6 +113,13 @@ } +void unfullscreen() { + if (wimp.current_desk->fullscreened != NULL) { + toggle_fullscreen(NULL); + } +} + + static void on_map(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, map_listener); if (wimp.can_steal_focus) @@ -132,6 +139,9 @@ static void on_surface_destroy(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, destroy_listener); + if (wimp.current_desk->fullscreened == view->surface) { + wimp.current_desk->fullscreened = NULL; + } wl_list_remove(&view->link); free(view); }
src/action.c Modified
@@ -99,6 +99,7 @@ } if (next) { + unfullscreen(); pan_to_view(next); focus_view(next, next->surface->surface); } @@ -138,6 +139,7 @@ dx = extents->width * (dx / 100); dy = extents->height * (dy / 100); } + unfullscreen(); struct view *view; wl_list_for_each(view, &desk->views, link) { view->x -= dx; @@ -151,6 +153,10 @@ void reset_zoom(void *data) { struct desk *desk = wimp.current_desk; double f = 1 / desk->zoom; + if (f == 1) { + return; + } + unfullscreen(); struct wlr_box *extents = wlr_output_layout_get_box(wimp.output_layout, NULL); double fx = extents->width * (f - 1) / 2; double fy = extents->height * (f - 1) / 2; @@ -175,6 +181,7 @@ ) { return; } + unfullscreen(); desk->zoom *= f; double fx = wimp.cursor->x * (f - 1) / desk->zoom; double fy = wimp.cursor->y * (f - 1) / desk->zoom; @@ -263,6 +270,7 @@ wl_list_for_each(mark, &wimp.marks, link) { if (mark->key == sym) { + unfullscreen(); struct motion motion = { .dx = mark->desk->panned_x - mark->x, .dy = mark->desk->panned_y - mark->y, @@ -293,17 +301,13 @@ return; struct view *view = wl_container_of(wimp.current_desk->views.next, view, link); - - if (wimp.current_desk->fullscreened == view->surface) { - fullscreen_xdg_surface(view, view->surface, NULL); - } - enum direction dir = *(enum direction*)data; double vx = view->x + view->surface->geometry.width / 2; double vy = view->y + view->surface->geometry.height / 2; double x, y, width, height; wlr_output_layout_closest_point(wimp.output_layout, NULL, vx, vy, &x, &y); struct wlr_output *output = wlr_output_layout_output_at(wimp.output_layout, x, y); + unfullscreen(); switch (dir) { case RIGHT: @@ -353,5 +357,6 @@ void send_to_desk(void *data) { struct view *view = wl_container_of(wimp.current_desk->views.next, view, link); int index = *(double*)data - 1; + unfullscreen(); view_to_desk(view, index); }