Skip to content

Commit 022fc79

Browse files
the-grue29jm
authored andcommitted
Replace cursor dot with pointer.
1 parent ed9a51d commit 022fc79

File tree

1 file changed

+21
-14
lines changed
  • kernel/src/misc/wm

1 file changed

+21
-14
lines changed

kernel/src/misc/wm/wm.c

+21-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <list.h>
1111
#include <stdlib.h>
1212

13-
#define MOUSE_SIZE 3
13+
#define MOUSE_SIZE 16
1414

1515
void wm_draw_window(wm_window_t* win, rect_t rect);
1616
void wm_partial_draw_window(wm_window_t* win, rect_t rect);
@@ -23,7 +23,7 @@ list_t* wm_get_window(uint32_t id);
2323
void wm_print_windows();
2424
list_t* wm_get_windows_above(wm_window_t* win);
2525
rect_t wm_mouse_to_rect(mouse_t mouse);
26-
void wm_draw_mouse(rect_t old, rect_t new);
26+
void wm_draw_mouse(rect_t new);
2727
void wm_mouse_callback(mouse_t curr);
2828
void wm_kbd_callback(kbd_event_t event);
2929

@@ -306,10 +306,6 @@ void wm_draw_window(wm_window_t* win, rect_t rect) {
306306

307307
kfree(clip_windows);
308308

309-
// Clip the mouse cursor too
310-
rect_t mouse_rect = wm_mouse_to_rect(mouse);
311-
rect_subtract_clip_rect(&clip_rects, mouse_rect);
312-
313309
// Draw what's left
314310
rect_t* clip;
315311
list_for_each_entry(clip, &clip_rects) {
@@ -318,6 +314,10 @@ void wm_draw_window(wm_window_t* win, rect_t rect) {
318314
}
319315
}
320316

317+
// Redraw the mouse
318+
rect_t mouse_rect = wm_mouse_to_rect(mouse);
319+
wm_draw_mouse(mouse_rect);
320+
321321
rect_clear_clipped(&clip_rects);
322322
}
323323

@@ -444,13 +444,19 @@ wm_window_t* wm_window_at(int32_t x, int32_t y) {
444444
return NULL;
445445
}
446446

447-
void wm_draw_mouse(rect_t old, rect_t new) {
448-
wm_refresh_partial(old);
449-
447+
void wm_draw_mouse(rect_t new) {
450448
uintptr_t addr = fb.address + new.top*fb.pitch + new.left*fb.bpp/8;
451449

452-
for (int32_t y = 0; y < new.bottom - new.top; y++) {
453-
memset((void*) addr, 127, (new.right - new.left)*fb.bpp/8);
450+
for (int32_t y = 0; y < new.bottom - new.top - 6; y++) {
451+
memset((void*) addr, 127, (y+1)*fb.bpp/8);
452+
addr += fb.pitch;
453+
}
454+
455+
addr += 4*fb.bpp/8;
456+
457+
for (int32_t y = 0; y < 6; y++) {
458+
memset((void*) addr, 127, 3*fb.bpp/8);
459+
addr += fb.bpp/8;
454460
addr += fb.pitch;
455461
}
456462
}
@@ -508,7 +514,7 @@ void wm_mouse_callback(mouse_t raw_curr) {
508514
wm_draw_window(dragged, new_rect);
509515

510516
rect = wm_mouse_to_rect(mouse);
511-
wm_draw_mouse(rect, rect);
517+
wm_draw_mouse(rect);
512518
}
513519
}
514520
}
@@ -547,7 +553,8 @@ void wm_mouse_callback(mouse_t raw_curr) {
547553
rect_t prev_pos = wm_mouse_to_rect(prev);
548554
rect_t curr_pos = wm_mouse_to_rect(mouse);
549555

550-
wm_draw_mouse(prev_pos, curr_pos);
556+
wm_refresh_partial(prev_pos);
557+
wm_draw_mouse(curr_pos);
551558
}
552559

553560
// Update the saved state
@@ -570,4 +577,4 @@ void wm_kbd_callback(kbd_event_t event) {
570577
}
571578
}
572579
}
573-
}
580+
}

0 commit comments

Comments
 (0)