mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-06 07:15:30 -04:00
Merge branch 'apply-scrollback-multiplier-in-alternate-scroll-mode'
This commit is contained in:
commit
fa1088da93
4 changed files with 14 additions and 7 deletions
|
|
@ -51,6 +51,9 @@
|
||||||
* PaperColorDark and PaperColorLight themes renamed to
|
* PaperColorDark and PaperColorLight themes renamed to
|
||||||
paper-color-dark and paper-color-light, for consistency with other
|
paper-color-dark and paper-color-light, for consistency with other
|
||||||
theme names.
|
theme names.
|
||||||
|
* `[scrollback].multiplier` is now applied in “alternate scroll” mode,
|
||||||
|
where scroll events are translated to fake arrow key presses on the
|
||||||
|
alt screen (https://codeberg.org/dnkl/foot/issues/859).
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
||||||
11
input.c
11
input.c
|
|
@ -2576,9 +2576,10 @@ mouse_scroll(struct seat *seat, int amount, enum wl_pointer_axis axis)
|
||||||
}
|
}
|
||||||
|
|
||||||
static float
|
static float
|
||||||
mouse_scroll_multiplier(const struct terminal *term)
|
mouse_scroll_multiplier(const struct terminal *term, const struct seat *seat)
|
||||||
{
|
{
|
||||||
return term->grid == &term->normal
|
return (term->grid == &term->normal ||
|
||||||
|
(term_mouse_grabbed(term, seat) && term->alt_scrolling))
|
||||||
? term->conf->scrollback.multiplier
|
? term->conf->scrollback.multiplier
|
||||||
: 1.0;
|
: 1.0;
|
||||||
}
|
}
|
||||||
|
|
@ -2595,6 +2596,8 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
|
||||||
xassert(seat->mouse_focus != NULL);
|
xassert(seat->mouse_focus != NULL);
|
||||||
xassert(axis < ALEN(seat->mouse.aggregated));
|
xassert(axis < ALEN(seat->mouse.aggregated));
|
||||||
|
|
||||||
|
const struct terminal *term = seat->mouse_focus;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Aggregate scrolled amount until we get at least 1.0
|
* Aggregate scrolled amount until we get at least 1.0
|
||||||
*
|
*
|
||||||
|
|
@ -2602,7 +2605,7 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
|
||||||
* anything.
|
* anything.
|
||||||
*/
|
*/
|
||||||
seat->mouse.aggregated[axis] +=
|
seat->mouse.aggregated[axis] +=
|
||||||
mouse_scroll_multiplier(seat->mouse_focus) * wl_fixed_to_double(value);
|
mouse_scroll_multiplier(term, seat) * wl_fixed_to_double(value);
|
||||||
if (fabs(seat->mouse.aggregated[axis]) < seat->mouse_focus->cell_height)
|
if (fabs(seat->mouse.aggregated[axis]) < seat->mouse_focus->cell_height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -2623,7 +2626,7 @@ wl_pointer_axis_discrete(void *data, struct wl_pointer *wl_pointer,
|
||||||
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
|
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
|
||||||
/* Treat mouse wheel left/right as regular buttons */
|
/* Treat mouse wheel left/right as regular buttons */
|
||||||
} else
|
} else
|
||||||
amount *= mouse_scroll_multiplier(seat->mouse_focus);
|
amount *= mouse_scroll_multiplier(seat->mouse_focus, seat);
|
||||||
|
|
||||||
mouse_scroll(seat, amount, axis);
|
mouse_scroll(seat, amount, axis);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2827,10 +2827,11 @@ report_mouse_motion(struct terminal *term, int encoded_button, int row, int col)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
term_mouse_grabbed(const struct terminal *term, struct seat *seat)
|
term_mouse_grabbed(const struct terminal *term, const struct seat *seat)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Mouse is grabbed by us, regardless of whether mouse tracking has been enabled or not.
|
* Mouse is grabbed by us, regardless of whether mouse tracking
|
||||||
|
* has been enabled or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
xkb_mod_mask_t mods;
|
xkb_mod_mask_t mods;
|
||||||
|
|
|
||||||
|
|
@ -759,7 +759,7 @@ void term_mouse_up(
|
||||||
void term_mouse_motion(
|
void term_mouse_motion(
|
||||||
struct terminal *term, int button, int row, int col,
|
struct terminal *term, int button, int row, int col,
|
||||||
bool shift, bool alt, bool ctrl);
|
bool shift, bool alt, bool ctrl);
|
||||||
bool term_mouse_grabbed(const struct terminal *term, struct seat *seat);
|
bool term_mouse_grabbed(const struct terminal *term, const struct seat *seat);
|
||||||
void term_xcursor_update(struct terminal *term);
|
void term_xcursor_update(struct terminal *term);
|
||||||
void term_xcursor_update_for_seat(struct terminal *term, struct seat *seat);
|
void term_xcursor_update_for_seat(struct terminal *term, struct seat *seat);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue