mirror of
https://github.com/labwc/labwc.git
synced 2026-02-06 04:06:33 -05:00
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.
This commit is contained in:
parent
9de487cecf
commit
2bf285a2c6
11 changed files with 271 additions and 44 deletions
|
|
@ -105,12 +105,12 @@ void edges_adjust_geom(struct view *view, struct border edges,
|
|||
uint32_t resize_edges, struct wlr_box *geom);
|
||||
|
||||
void edges_find_neighbors(struct border *nearest_edges, struct view *view,
|
||||
struct wlr_box target, struct output *output,
|
||||
edge_validator_t validator, bool use_pending, bool ignore_hidden);
|
||||
struct wlr_box origin, struct wlr_box target,
|
||||
struct output *output, edge_validator_t validator, bool ignore_hidden);
|
||||
|
||||
void edges_find_outputs(struct border *nearest_edges, struct view *view,
|
||||
struct wlr_box target, struct output *output,
|
||||
edge_validator_t validator, bool use_pending);
|
||||
struct wlr_box origin, struct wlr_box target,
|
||||
struct output *output, edge_validator_t validator);
|
||||
|
||||
void edges_adjust_move_coords(struct view *view, struct border edges,
|
||||
int *x, int *y, bool use_pending);
|
||||
|
|
|
|||
20
include/snap-constraints.h
Normal file
20
include/snap-constraints.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_SNAP_CONSTRAINTS_H
|
||||
#define LABWC_SNAP_CONSTRAINTS_H
|
||||
|
||||
#include "common/border.h"
|
||||
#include "view.h"
|
||||
|
||||
struct wlr_box;
|
||||
|
||||
void snap_constraints_set(struct view *view,
|
||||
enum view_edge direction, struct wlr_box geom);
|
||||
|
||||
void snap_constraints_invalidate(struct view *view);
|
||||
|
||||
void snap_constraints_update(struct view *view);
|
||||
|
||||
struct wlr_box snap_constraints_effective(struct view *view,
|
||||
enum view_edge direction);
|
||||
|
||||
#endif /* LABWC_SNAP_CONSTRAINTS_H */
|
||||
|
|
@ -16,4 +16,7 @@ void snap_grow_to_next_edge(struct view *view,
|
|||
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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue