From 6e975919c8c04f299aec7b06409f7f2222c5b2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Tue, 20 Jan 2026 15:32:41 -0500 Subject: [PATCH] feat: add flag to enable/disable mouse --- libs_win32/app.h | 19 ++++++++++++------- libs_win32/app_types.h | 4 ++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libs_win32/app.h b/libs_win32/app.h index d293f8e..a74a5f0 100644 --- a/libs_win32/app.h +++ b/libs_win32/app.h @@ -1288,7 +1288,7 @@ static LRESULT CALLBACK app_internal_wndproc( HWND hwnd, UINT message, WPARAM wp break; case WM_MOUSEMOVE: - if( app->has_focus ) + if( app->has_focus && ALLOW_MOUSE ) { POINT p; GetCursorPos( &p ); @@ -1312,7 +1312,7 @@ static LRESULT CALLBACK app_internal_wndproc( HWND hwnd, UINT message, WPARAM wp app->GetRawInputDataPtr( (HRAWINPUT) lparam, RID_INPUT, &raw, &size, sizeof( RAWINPUTHEADER ) ); if( raw.header.dwType == RIM_TYPEMOUSE ) { - if( ( raw.data.mouse.usFlags & 1 ) == MOUSE_MOVE_RELATIVE) + if( ( raw.data.mouse.usFlags & 1 ) == MOUSE_MOVE_RELATIVE && ALLOW_MOUSE ) { float dx = (float) raw.data.mouse.lLastX; float dy = (float) raw.data.mouse.lLastY; @@ -2249,6 +2249,7 @@ void app_interpolation( app_t* app, app_interpolation_t interpolation ) if( interpolation == app->interpolation ) return; app->interpolation = interpolation; +if( ALLOW_MOUSE ) { POINT p; GetCursorPos( &p ); ScreenToClient( app->hwnd, &p ); @@ -2260,7 +2261,7 @@ void app_interpolation( app_t* app, app_interpolation_t interpolation ) input_event.data.mouse_pos.x = mouse_x; input_event.data.mouse_pos.y = mouse_y; app_internal_add_input_event( app, &input_event ); - +} app_internal_opengl_interpolation( &app->gl, interpolation ); } @@ -3064,7 +3065,7 @@ app_state_t app_yield( app_t* app ) app_internal_add_input_event( app, &input_event ); } } - else if( e.type == SDL_MOUSEMOTION ) + else if( e.type == SDL_MOUSEMOTION && ALLOW_MOUSE ) { app_input_event_t input_event; input_event.type = APP_INPUT_MOUSE_MOVE; @@ -3219,6 +3220,7 @@ void app_interpolation( app_t* app, app_interpolation_t interpolation ) int mouse_y; SDL_GetMouseState( &mouse_x, &mouse_y ); + if( ALLOW_MOUSE ) { app_input_event_t input_event; input_event.type = APP_INPUT_MOUSE_MOVE; input_event.data.mouse_pos.x = mouse_x; @@ -3546,10 +3548,12 @@ void, app_js_setup_canvas, (int* out_width, int* out_height), }); canvasEvent('mousemove', (e)=> { + if( ALLOW_MOUSE ) { evts.push(5, - (e.offsetX * canvas.width / canvas.clientWidth )|0, - (e.offsetY * canvas.height / canvas.clientHeight)|0); - cancelEvent(e); + (e.offsetX * canvas.width / canvas.clientWidth )|0, + (e.offsetY * canvas.height / canvas.clientHeight)|0); + cancelEvent(e); + } }); var buttons = 0; canvasEvent('mousedown', (e)=> @@ -3788,6 +3792,7 @@ app_state_t app_yield( app_t* app ) app_internal_add_input_event( app, &input_event ); break; case 5: // MOUSE_MOTION x y + if( ALLOW_MOUSE ) { input_event.type = APP_INPUT_MOUSE_MOVE; app->pointer_x = input_event.data.mouse_pos.x = evt[1]; app->pointer_y = input_event.data.mouse_pos.y = evt[2]; diff --git a/libs_win32/app_types.h b/libs_win32/app_types.h index 95db9a2..c27505b 100644 --- a/libs_win32/app_types.h +++ b/libs_win32/app_types.h @@ -11,6 +11,10 @@ #endif #include "app_opengl.h" +#ifndef ALLOW_MOUSE +#define ALLOW_MOUSE 1 +#endif + typedef struct app_t app_t; typedef enum app_log_level_t { APP_LOG_LEVEL_INFO,