mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-09 15:08:13 +02:00
Scale pointer axis events by effective scale
This commit is contained in:
4
glfw/wl_init.c
vendored
4
glfw/wl_init.c
vendored
@@ -346,14 +346,14 @@ static void pointerHandleAxis(void* data UNUSED,
|
||||
window->wl.axis_discrete_count.x--;
|
||||
return;
|
||||
}
|
||||
x = -wl_fixed_to_double(value) * (window->wl.integer_scale);
|
||||
x = -wl_fixed_to_double(value) * _glfwWaylandWindowScale(window);
|
||||
}
|
||||
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) {
|
||||
if (window->wl.axis_discrete_count.y) {
|
||||
window->wl.axis_discrete_count.y--;
|
||||
return;
|
||||
}
|
||||
y = -wl_fixed_to_double(value) * (window->wl.integer_scale);
|
||||
y = -wl_fixed_to_double(value) * _glfwWaylandWindowScale(window);
|
||||
}
|
||||
|
||||
_glfwInputScroll(window, x, y, 1, _glfw.wl.xkb.states.modifiers);
|
||||
|
||||
1
glfw/wl_platform.h
vendored
1
glfw/wl_platform.h
vendored
@@ -379,6 +379,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
||||
void _glfwWaylandAfterBufferSwap(_GLFWwindow *window);
|
||||
void _glfwSetupWaylandDataDevice(void);
|
||||
void _glfwSetupWaylandPrimarySelectionDevice(void);
|
||||
float _glfwWaylandWindowScale(_GLFWwindow*);
|
||||
void animateCursorImage(id_type timer_id, void *data);
|
||||
struct wl_cursor* _glfwLoadCursor(GLFWCursorShape, struct wl_cursor_theme*);
|
||||
void destroy_data_offer(_GLFWWaylandDataOffer*);
|
||||
|
||||
10
glfw/wl_window.c
vendored
10
glfw/wl_window.c
vendored
@@ -323,8 +323,8 @@ static void setOpaqueRegion(_GLFWwindow* window, bool commit_surface)
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
static float
|
||||
effective_window_scale(_GLFWwindow *window) {
|
||||
float
|
||||
_glfwWaylandWindowScale(_GLFWwindow *window) {
|
||||
float ans = window->wl.integer_scale;
|
||||
if (window->wl.fractional_scale) ans = window->wl.fractional_scale / 120.f;
|
||||
return ans;
|
||||
@@ -332,7 +332,7 @@ effective_window_scale(_GLFWwindow *window) {
|
||||
|
||||
static void
|
||||
resizeFramebuffer(_GLFWwindow* window) {
|
||||
float scale = effective_window_scale(window);
|
||||
float scale = _glfwWaylandWindowScale(window);
|
||||
int scaled_width = (int)roundf(window->wl.width * scale);
|
||||
int scaled_height = (int)roundf(window->wl.height * scale);
|
||||
debug("Resizing framebuffer to: %dx%d window size: %dx%d at scale: %.2f\n",
|
||||
@@ -1162,7 +1162,7 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
|
||||
int* width, int* height)
|
||||
{
|
||||
_glfwPlatformGetWindowSize(window, width, height);
|
||||
float fscale = effective_window_scale(window);
|
||||
float fscale = _glfwWaylandWindowScale(window);
|
||||
if (width)
|
||||
*width = (int)roundf(*width * fscale);
|
||||
if (height)
|
||||
@@ -1189,7 +1189,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
||||
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
||||
float* xscale, float* yscale)
|
||||
{
|
||||
float fscale = effective_window_scale(window);
|
||||
float fscale = _glfwWaylandWindowScale(window);
|
||||
if (xscale)
|
||||
*xscale = fscale;
|
||||
if (yscale)
|
||||
|
||||
Reference in New Issue
Block a user