mirror of
https://github.com/labwc/labwc.git
synced 2026-02-27 01:40:30 -05:00
overlay: add snap-to-edge overlay (PR #1652)
...and unify region overlay and snap-to-edge overlay into overlay.c. Snap-to-edge overlay is delayed for 500ms to prevent flickering when the view is dragged from an output to another (demo in discussion labwc#1613). This also fixes a bug that region overlay is not shown when a modifier key is re-pressed.
This commit is contained in:
parent
67669dcf1e
commit
5cc0757390
16 changed files with 361 additions and 152 deletions
|
|
@ -225,16 +225,7 @@ process_cursor_move(struct server *server, uint32_t time)
|
|||
resistance_move_apply(view, &dx, &dy);
|
||||
view_move(view, dx, dy);
|
||||
|
||||
/* Region overlay */
|
||||
if (!regions_should_snap(server)) {
|
||||
return;
|
||||
}
|
||||
struct region *region = regions_from_cursor(server);
|
||||
if (region) {
|
||||
regions_show_overlay(view, &server->seat, region);
|
||||
} else {
|
||||
regions_hide_overlay(&server->seat);
|
||||
}
|
||||
overlay_update(&server->seat);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -80,11 +80,13 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
|||
if (server->input_mode == LAB_INPUT_STATE_MOVE) {
|
||||
/* Any change to the modifier state re-enable region snap */
|
||||
seat->region_prevent_snap = false;
|
||||
/* Pressing/releasing modifier key may show/hide region overlay */
|
||||
overlay_update(seat);
|
||||
}
|
||||
|
||||
if (server->osd_state.cycle_view || server->grabbed_view
|
||||
if (server->osd_state.cycle_view
|
||||
|| seat->workspace_osd_shown_by_modifier) {
|
||||
if (!keyboard_any_modifiers_pressed(wlr_keyboard)) {
|
||||
if (!keyboard_any_modifiers_pressed(wlr_keyboard)) {
|
||||
if (server->osd_state.cycle_view) {
|
||||
if (key_state_nr_bound_keys()) {
|
||||
should_cancel_cycling_on_next_key_release = true;
|
||||
|
|
@ -95,9 +97,6 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
|||
if (seat->workspace_osd_shown_by_modifier) {
|
||||
workspaces_osd_hide(seat);
|
||||
}
|
||||
if (server->grabbed_view) {
|
||||
regions_hide_overlay(seat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue