mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/gtk-ng: fix scrolling on surface
We forgot to specify the scroll controller's `flags` property.
This commit is contained in:
@ -1647,32 +1647,30 @@ pub const Surface = extern struct {
|
|||||||
self: *Self,
|
self: *Self,
|
||||||
) callconv(.c) c_int {
|
) callconv(.c) c_int {
|
||||||
const priv = self.private();
|
const priv = self.private();
|
||||||
if (priv.core_surface) |surface| {
|
const surface = priv.core_surface orelse return 0;
|
||||||
// Multiply precision scrolls by 10 to get a better response from
|
|
||||||
// touchpad scrolling
|
|
||||||
const multiplier: f64 = if (priv.precision_scroll) 10.0 else 1.0;
|
|
||||||
const scroll_mods: input.ScrollMods = .{
|
|
||||||
.precision = priv.precision_scroll,
|
|
||||||
};
|
|
||||||
|
|
||||||
const scaled = self.scaledCoordinates(x, y);
|
// Multiply precision scrolls by 10 to get a better response from
|
||||||
surface.scrollCallback(
|
// touchpad scrolling
|
||||||
// We invert because we apply natural scrolling to the values.
|
const multiplier: f64 = if (priv.precision_scroll) 10.0 else 1.0;
|
||||||
// This behavior has existed for years without Linux users complaining
|
const scroll_mods: input.ScrollMods = .{
|
||||||
// but I suspect we'll have to make this configurable in the future
|
.precision = priv.precision_scroll,
|
||||||
// or read a system setting.
|
};
|
||||||
scaled.x * -1 * multiplier,
|
|
||||||
scaled.y * -1 * multiplier,
|
|
||||||
scroll_mods,
|
|
||||||
) catch |err| {
|
|
||||||
log.warn("error in scroll callback err={}", .{err});
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
return 1;
|
const scaled = self.scaledCoordinates(x, y);
|
||||||
}
|
surface.scrollCallback(
|
||||||
|
// We invert because we apply natural scrolling to the values.
|
||||||
|
// This behavior has existed for years without Linux users complaining
|
||||||
|
// but I suspect we'll have to make this configurable in the future
|
||||||
|
// or read a system setting.
|
||||||
|
scaled.x * -1 * multiplier,
|
||||||
|
scaled.y * -1 * multiplier,
|
||||||
|
scroll_mods,
|
||||||
|
) catch |err| {
|
||||||
|
log.warn("error in scroll callback err={}", .{err});
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn imPreeditStart(
|
fn imPreeditStart(
|
||||||
|
@ -103,6 +103,7 @@ template $GhosttySurface: Adw.Bin {
|
|||||||
scroll => $scroll();
|
scroll => $scroll();
|
||||||
scroll-begin => $scroll_begin();
|
scroll-begin => $scroll_begin();
|
||||||
scroll-end => $scroll_end();
|
scroll-end => $scroll_end();
|
||||||
|
flags: both_axes;
|
||||||
}
|
}
|
||||||
|
|
||||||
GestureClick {
|
GestureClick {
|
||||||
|
Reference in New Issue
Block a user