10
10
#include <list.h>
11
11
#include <stdlib.h>
12
12
13
- #define MOUSE_SIZE 3
13
+ #define MOUSE_SIZE 16
14
14
15
15
void wm_draw_window (wm_window_t * win , rect_t rect );
16
16
void wm_partial_draw_window (wm_window_t * win , rect_t rect );
@@ -23,7 +23,7 @@ list_t* wm_get_window(uint32_t id);
23
23
void wm_print_windows ();
24
24
list_t * wm_get_windows_above (wm_window_t * win );
25
25
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 );
27
27
void wm_mouse_callback (mouse_t curr );
28
28
void wm_kbd_callback (kbd_event_t event );
29
29
@@ -306,10 +306,6 @@ void wm_draw_window(wm_window_t* win, rect_t rect) {
306
306
307
307
kfree (clip_windows );
308
308
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
-
313
309
// Draw what's left
314
310
rect_t * clip ;
315
311
list_for_each_entry (clip , & clip_rects ) {
@@ -318,6 +314,10 @@ void wm_draw_window(wm_window_t* win, rect_t rect) {
318
314
}
319
315
}
320
316
317
+ // Redraw the mouse
318
+ rect_t mouse_rect = wm_mouse_to_rect (mouse );
319
+ wm_draw_mouse (mouse_rect );
320
+
321
321
rect_clear_clipped (& clip_rects );
322
322
}
323
323
@@ -444,13 +444,19 @@ wm_window_t* wm_window_at(int32_t x, int32_t y) {
444
444
return NULL ;
445
445
}
446
446
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 ) {
450
448
uintptr_t addr = fb .address + new .top * fb .pitch + new .left * fb .bpp /8 ;
451
449
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 ;
454
460
addr += fb .pitch ;
455
461
}
456
462
}
@@ -508,7 +514,7 @@ void wm_mouse_callback(mouse_t raw_curr) {
508
514
wm_draw_window (dragged , new_rect );
509
515
510
516
rect = wm_mouse_to_rect (mouse );
511
- wm_draw_mouse (rect , rect );
517
+ wm_draw_mouse (rect );
512
518
}
513
519
}
514
520
}
@@ -547,7 +553,8 @@ void wm_mouse_callback(mouse_t raw_curr) {
547
553
rect_t prev_pos = wm_mouse_to_rect (prev );
548
554
rect_t curr_pos = wm_mouse_to_rect (mouse );
549
555
550
- wm_draw_mouse (prev_pos , curr_pos );
556
+ wm_refresh_partial (prev_pos );
557
+ wm_draw_mouse (curr_pos );
551
558
}
552
559
553
560
// Update the saved state
@@ -570,4 +577,4 @@ void wm_kbd_callback(kbd_event_t event) {
570
577
}
571
578
}
572
579
}
573
- }
580
+ }
0 commit comments