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 <anchao.archer@bytedance.com>
This commit is contained in:
xingrentai.1
2026-02-26 17:34:44 +08:00
committed by Xiang Xiao
parent ee3e931812
commit bf83ff3fbd
@@ -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;