mirror of
https://github.com/BoredDevNL/BoredOS.git
synced 2026-05-15 10:48:38 +00:00
FIX: Mouse trailing with single core CPU's
This commit is contained in:
parent
e95c82b162
commit
5604866882
3 changed files with 24 additions and 3 deletions
|
|
@ -171,6 +171,10 @@ void graphics_clear_dirty(void) {
|
||||||
wm_lock_release(rflags);
|
wm_lock_release(rflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void graphics_clear_dirty_no_lock(void) {
|
||||||
|
g_dirty.active = false;
|
||||||
|
}
|
||||||
|
|
||||||
void graphics_set_render_target(uint32_t *buffer, int w, int h) {
|
void graphics_set_render_target(uint32_t *buffer, int w, int h) {
|
||||||
g_render_target = buffer;
|
g_render_target = buffer;
|
||||||
g_rt_width = w;
|
g_rt_width = w;
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ void graphics_mark_dirty(int x, int y, int w, int h);
|
||||||
void graphics_mark_screen_dirty(void);
|
void graphics_mark_screen_dirty(void);
|
||||||
DirtyRect graphics_get_dirty_rect(void);
|
DirtyRect graphics_get_dirty_rect(void);
|
||||||
void graphics_clear_dirty(void);
|
void graphics_clear_dirty(void);
|
||||||
|
void graphics_clear_dirty_no_lock(void);
|
||||||
|
|
||||||
// Double buffering
|
// Double buffering
|
||||||
void graphics_flip_buffer(void);
|
void graphics_flip_buffer(void);
|
||||||
|
|
|
||||||
22
src/wm/wm.c
22
src/wm/wm.c
|
|
@ -1280,6 +1280,9 @@ void wm_paint(void) {
|
||||||
|
|
||||||
uint64_t rflags;
|
uint64_t rflags;
|
||||||
rflags = wm_lock_acquire();
|
rflags = wm_lock_acquire();
|
||||||
|
|
||||||
|
wm_mark_dirty(last_cursor_x, last_cursor_y, 12, 12);
|
||||||
|
wm_mark_dirty(mx, my, 12, 12);
|
||||||
|
|
||||||
DirtyRect dirty = graphics_get_dirty_rect();
|
DirtyRect dirty = graphics_get_dirty_rect();
|
||||||
|
|
||||||
|
|
@ -1528,6 +1531,7 @@ void wm_paint(void) {
|
||||||
|
|
||||||
// Flip the buffer - display the rendered frame atomically
|
// Flip the buffer - display the rendered frame atomically
|
||||||
graphics_flip_buffer();
|
graphics_flip_buffer();
|
||||||
|
graphics_clear_dirty_no_lock();
|
||||||
|
|
||||||
// Restore IRQs
|
// Restore IRQs
|
||||||
wm_lock_release(rflags);
|
wm_lock_release(rflags);
|
||||||
|
|
@ -1612,8 +1616,16 @@ void wm_remove_window(Window *win) {
|
||||||
}
|
}
|
||||||
window_count--;
|
window_count--;
|
||||||
|
|
||||||
if (active_mouse_capture_win == win) {
|
if (active_mouse_capture_win == win) active_mouse_capture_win = NULL;
|
||||||
active_mouse_capture_win = NULL;
|
|
||||||
|
if (drag_window == win) {
|
||||||
|
is_dragging = false;
|
||||||
|
is_resizing = false;
|
||||||
|
drag_window = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drag_src_win == win) {
|
||||||
|
drag_src_win = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark for redraw while protected
|
// Mark for redraw while protected
|
||||||
|
|
@ -1958,6 +1970,11 @@ void wm_handle_right_click(int x, int y) {
|
||||||
if (mx >= sw) mx = sw - 1;
|
if (mx >= sw) mx = sw - 1;
|
||||||
if (my >= sh) my = sh - 1;
|
if (my >= sh) my = sh - 1;
|
||||||
|
|
||||||
|
if (move_x != 0 || move_y != 0) {
|
||||||
|
wm_mark_dirty(prev_mx, prev_my, 12, 12); // Extra padding for safety
|
||||||
|
wm_mark_dirty(mx, my, 12, 12);
|
||||||
|
}
|
||||||
|
|
||||||
if (dz != 0) {
|
if (dz != 0) {
|
||||||
// Find focused window and send wheel event
|
// Find focused window and send wheel event
|
||||||
for (int w = 0; w < window_count; w++) {
|
for (int w = 0; w < window_count; w++) {
|
||||||
|
|
@ -2692,7 +2709,6 @@ void wm_process_input(void) {
|
||||||
DirtyRect dirty = graphics_get_dirty_rect();
|
DirtyRect dirty = graphics_get_dirty_rect();
|
||||||
if (dirty.active) {
|
if (dirty.active) {
|
||||||
wm_paint();
|
wm_paint();
|
||||||
graphics_clear_dirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue