This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit bf83ff3fbd7942f144d48761d613285c857d4883
Author: xingrentai.1 <[email protected]>
AuthorDate: Thu Feb 26 17:34:44 2026 +0800

    arch/sim: guard X11 touchscreen events with CONFIG_SIM_TOUCHSCREEN
    
    The X11 event loop in the POSIX simulator was processing MotionNotify
    (touch/mouse movement)and ButtonPress/ButtonRelease events unconditionally,
    even when the touchscreen feature(CONFIG_SIM_TOUCHSCREEN) was disabled.
    
    This could lead to unnecessary event processing, potential compiler warnings
    about unusedfunctions (e.g., sim_buttonevent), or unintended behavior in 
simulator
    builds withouttouchscreen support. The touchscreen-related event handling 
should
    only be active whenthe corresponding configuration is enabled.
    
    This fix wraps the MotionNotify and ButtonPress/ButtonRelease event handling
    logicwith #ifdef CONFIG_SIM_TOUCHSCREEN guards to:
    
    1. Ensure touchscreen/mouse event processing is only compiled when 
CONFIG_SIM_TOUCHSCREEN is enabled.
    2. Eliminate unused code warnings in non-touchscreen simulator builds.
    3. Align event loop behavior with the configured feature set, reducing 
unnecessary runtime overhead.
    
    The change maintains full touchscreen functionality when the config is 
enabled, whilecleaning up the
    code path for builds that don't require touchscreen support.
    
    Signed-off-by: chao an <[email protected]>
---
 arch/sim/src/sim/posix/sim_x11eventloop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sim/src/sim/posix/sim_x11eventloop.c 
b/arch/sim/src/sim/posix/sim_x11eventloop.c
index 713267ec894..5539293ddf2 100644
--- a/arch/sim/src/sim/posix/sim_x11eventloop.c
+++ b/arch/sim/src/sim/posix/sim_x11eventloop.c
@@ -128,6 +128,7 @@ void sim_x11events(void)
             break;
           #endif
 
+          #ifdef CONFIG_SIM_TOUCHSCREEN
           case MotionNotify : /* Enabled by ButtonMotionMask */
             {
               sim_buttonevent(event.xmotion.x, event.xmotion.y,
@@ -143,6 +144,7 @@ void sim_x11events(void)
                                           event.xbutton.button));
             }
             break;
+          #endif
 
           default:
             break;

Reply via email to