fix: kernel and desktop bug fixes

This commit is contained in:
2026-05-14 11:31:14 +02:00
parent 2abee0c634
commit 4fde39397a
11 changed files with 507 additions and 106 deletions
+10 -6
View File
@@ -677,8 +677,10 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
ds->vol_popup_open = false;
}
// Forward continuous mouse events to focused window (hover, drag, release)
if (!left_pressed && ds->focused_window >= 0) {
// Forward continuous mouse events to focused window (hover, drag, release).
// Scroll is sent separately below; clearing ev.scroll here prevents local
// on_mouse handlers from receiving the same scroll twice.
if (!left_pressed && ds->focused_window >= 0 && ds->focused_window < ds->window_count) {
Window* win = &ds->windows[ds->focused_window];
if (win->state != WIN_MINIMIZED && win->state != WIN_CLOSED) {
Rect cr = desktop_content_rect(win);
@@ -695,16 +697,18 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
wev.mouse.prev_buttons = prev;
montauk::win_sendevent(win->ext_win_id, &wev);
} else if (win->on_mouse) {
ev.x = mx;
ev.y = my;
win->on_mouse(win, ev);
MouseEvent hover = ev;
hover.x = mx;
hover.y = my;
hover.scroll = 0;
win->on_mouse(win, hover);
}
}
}
}
// Handle scroll events on focused window
if (ev.scroll != 0 && ds->focused_window >= 0) {
if (ev.scroll != 0 && ds->focused_window >= 0 && ds->focused_window < ds->window_count) {
Window* win = &ds->windows[ds->focused_window];
Rect cr = desktop_content_rect(win);
if (cr.contains(mx, my)) {