commit 28e217f
uint
·
2026-06-09 19:22:49 +0000 UTC
parent e200d2a
basic-window: draw only on mb1 press
2 files changed,
+7,
-4
M
TODO
+0,
-2
1@@ -1,7 +1,5 @@
2 Maus:
3 [-] Clipboard
4-[X] Cursor {normal, hidden, locked}
5-[-] Mouse buttons
6 [?] Cursor warping
7 [?] Text buffer
8 [?] Double buffering
+7,
-2
1@@ -6,6 +6,7 @@
2 int mx, my;
3 bool cur_visible = true;
4 bool cur_locked = false;
5+bool mb1_pressed = false;
6
7 void handle_ev(Maus* mw, MausEvent* ev)
8 {
9@@ -39,8 +40,12 @@ void handle_ev(Maus* mw, MausEvent* ev)
10
11 break;
12 }
13- case MAUS_EV_MOUSE_BUTTON:
14+ case MAUS_EV_MOUSE_BUTTON: {
15+ mb1_pressed =
16+ mw->mouse_buttons[MAUS_MOUSE_BUTTON_LEFT] ?
17+ true : false;
18 break;
19+ }
20 case MAUS_EV_MOUSE_MOTION: {
21 mx = ev->mouse.motion.x;
22 my = ev->mouse.motion.y;
23@@ -77,7 +82,7 @@ int main(void)
24 (void) handle_ev(mw, &ev);
25 if (mx >= 0 && my >= 0 &&
26 mx < (int32_t)mw->width &&
27- my < (int32_t)mw->height) {
28+ my < (int32_t)mw->height && mb1_pressed) {
29 MAUS_PIXEL_AT(mw, mx, my) = MAUS_UNPACK_COL(red);
30 }
31