How tascvh/trackpad-is-too-damn-big works
Project’s Purpose and Scope
• Project Type: A native Linux utility designed to customize and modify trackpad behavior. It works at a low level, intercepting events from the trackpad device and applying custom filters and handling logic.
• Key Features: Cropping out specific areas of the trackpad and controlling how the device responds in those areas, including multitouch gesture recognition.
File Structure
• Top-Level Files:
• .gitignore, LICENSE, CMakeLists.txt, README.md: Standard project management files useful for build configuration and licensing.
• Source Files (in the “src” directory):
• main.cpp: Likely the entry point that initializes the application.
• devices.hpp: Provides abstractions or definitions for the trackpad or related hardware.
• evdev_helper.c: Contains low-level functions to interact with the Linux evdev (event device) API, handling input devices.
• event_filters.hpp & event_handlers.hpp: Define functions or classes that implement the logic for filtering trackpad events and performing the necessary adjustments.
• simple_parser.hpp: Likely a lightweight parser for configuration or specifying the exact domains (percentages) that need to be cropped/disabled.
Essential Components
a. Main Application Engine:
• Represented by main.cpp. It orchestrates initialization, configuration parsing, and module integration.
b. Configuration & Parsing:
• simple_parser.hpp: Handles input configurations (likely from user parameters or configuration files) that specify how and where the trackpad behavior should be modified.
c. Device Interaction Layer:
• devices.hpp: Abstraction layer for representing the trackpad device.
• evdev_helper.c: Directly interfaces with the Linux evdev subsystem. Illustrate how this component reads raw input events from the trackpad.
d. Event Processing Pipeline:
• event_filters.hpp: Applies custom filters to determine if an event should be modified or dropped based on the restricted areas indicated.
• event_handlers.hpp: Processes the filtered events, then dispatches them in a form that ensures proper multitouch and gesture recognition.
• The Main Application (main.cpp) initializes the system and loads the configuration using the configuration parser.
• It then integrates the Device Interaction Layer, which pulls data directly from the trackpad through evdev_helper.c.
• The raw input events are sent into the Event Processing Pipeline where event_filters and event_handlers are applied sequentially.
• Finally, the processed events are output (or injected back into the system) in way that modifies the trackpad behavior.
Architectural Patterns and Design Principles
• Separation of Concerns: Each module (device interface, parser, event filtering, and handling) is handled by dedicated components.
• Pipeline/Flow Architecture: Emphasize a sequential flow where raw events are progressively refined by filters and handlers.
• Modular Design: The structure suggests ease of replacement or modification (e.g., switching out how events are handled without changing device interaction).