labwc/include/snap.h
Andrew J. Hesford 2bf285a2c6 snap: cache and ignore last-snapped edge when growing or shrinking
When growing or shrinking a view by snapping to an edge, a client may
ignore the requested size and instead keep its original size or
substitute a different (possibly constrained) size. In this case, the
view may not actually contact the snapped edge, and a subsequent snap
attempt will just keep re-trying (and failing) to contact the same ege.

To mitigate this, remember the last-snapped view, snapping direction and
offset of the snapping edge in snap.c; when re-attempting a snap for the
same view in the same direction, ignore the edge that was last "hit", to
allow snapping to progress beyond the problematic edge.
2024-04-10 23:30:28 +01:00

22 lines
588 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_SNAP_H
#define LABWC_SNAP_H
#include "common/border.h"
#include "view.h"
struct wlr_box;
void snap_move_to_edge(struct view *view,
enum view_edge direction, bool snap_to_windows, int *dx, int *dy);
void snap_grow_to_next_edge(struct view *view,
enum view_edge direction, struct wlr_box *geo);
void snap_shrink_to_next_edge(struct view *view,
enum view_edge direction, struct wlr_box *geo);
void snap_invalidate_edge_cache(struct view *view);
void snap_update_cache_geometry(struct view *view);
#endif /* LABWC_SNAP_H */