Build on new PC, fix wheel not scrolling

This commit is contained in:
krzosa
2025-12-21 22:04:39 +01:00
parent c8a7c75dbe
commit 79d709d391
6 changed files with 30 additions and 13 deletions

View File

@@ -7,6 +7,7 @@
#include <stdarg.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
#if defined(__APPLE__) && defined(__MACH__)

View File

@@ -363,4 +363,4 @@ API Int ChopNumber(String *string) {
if (col.len == 0) return -1;
Int result = strtoll(col.data, NULL, 10) - 1;
return result;
}
}

View File

@@ -369,7 +369,7 @@ API Int SkipNumber(String16 *string) {
if (col.len == 0) return -1;
Scratch scratch;
String num_string = ToString(scratch, col);
Int result = strtoll(num_string.data, NULL, 10);
Int result = strtoll(num_string.data, NULL, 10);
return result;
}
@@ -416,4 +416,4 @@ API Int ChopNumber(String16 *string) {
String num_string = ToString(scratch, col);
Int result = strtoll(num_string.data, NULL, 10) - 1;
return result;
}
}

View File

@@ -431,8 +431,8 @@ Event TranslateSDLEvent(SDL_Event *input_event) {
case SDL_EVENT_MOUSE_WHEEL: {
event.kind = EVENT_MOUSE_WHEEL;
SDL_MouseWheelEvent &b = input_event->wheel;
event.xmouse = (int16_t)roundf(DPIScale * b.x);
event.ymouse = (int16_t)roundf(DPIScale * b.y);
event.xmouse = (int16_t)roundf(DPIScale * b.mouse_x);
event.ymouse = (int16_t)roundf(DPIScale * b.mouse_y);
event.xwheel = b.x;
event.ywheel = b.y;
} break;

View File

@@ -178,15 +178,16 @@ void OnCommand(Event event) {
if (event.xwheel || event.ywheel) {
Vec2I mouse = MouseVec2I();
For(order) {
if (!it->visible) continue;
For (order) {
if (!it->visible) {
continue;
}
bool mouse_in_window = AreOverlapping(mouse, it->total_rect);
if (mouse_in_window) {
View *view = GetView(it->active_view);
view->scroll.y -= (Int)(event.ywheel * 48);
view->scroll.x += (Int)(event.xwheel * 48);
break;
}
}
}