mirror of
https://github.com/nicbarker/clay.git
synced 2026-02-06 12:48:49 +00:00
This commit addresses issues with mouse interaction reliability and build configuration in the Ncurses renderer and example. Renderer Changes: - Enable explicit xterm 1003 mouse tracking (Any Event) via escape sequences to ensure reliable hover sensing from the first frame (though not so portable). - Refactor `Clay_Ncurses_ProcessInput` to: - Correctly order `Clay_SetPointerState` calls to ensure the "Pressed" state is registered before the function returns. - Detect and return a new `CLAY_NCURSES_KEY_MOUSE_CLICK` event code for single, double, and triple clicks. - Make `Clay_Ncurses_OnClick` as a semantic wrapper around `Clay_OnHover`. - Add empty switch cases for `CLAY_RENDER_COMMAND_TYPE_IMAGE` and `CLAY_RENDER_COMMAND_TYPE_CUSTOM` to prevent unhandled enumeration warnings. Example Application Changes: - Update `main.c` to break the input processing loop immediately upon receiving `CLAY_NCURSES_KEY_MOUSE_CLICK`, ensuring the "Pressed" state is processed by the layout engine for that frame. Build System: - Update `CMakeLists.txt` to replace `FindCurses` with `find_library` and `find_path` for `ncursesw`.
19 lines
595 B
CMake
19 lines
595 B
CMake
cmake_minimum_required(VERSION 3.27)
|
|
project(clay-ncurses-example C)
|
|
|
|
|
|
# Find ncursesw explicitly
|
|
find_library(NCURSESW_LIB NAMES ncursesw REQUIRED)
|
|
find_path(NCURSESW_INCLUDE_DIR NAMES ncurses.h PATH_SUFFIXES ncursesw)
|
|
|
|
add_compile_definitions(_XOPEN_SOURCE_EXTENDED _XOPEN_SOURCE=700)
|
|
|
|
add_executable(clay-ncurses-example main.c)
|
|
|
|
target_link_libraries(clay-ncurses-example PRIVATE ${NCURSESW_LIB})
|
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
target_link_libraries(clay-ncurses-example PRIVATE m)
|
|
endif()
|
|
|
|
target_include_directories(clay-ncurses-example PRIVATE ${NCURSESW_INCLUDE_DIR} ../../)
|