Repository navigation
Fix button highlighting bugs and optimize memory for Raspberry Pi CM5 - #337
Merged
Merged
Conversation
Object Pool System: - Add src/core/object_pool.hh with thread-safe ObjectPool<T> template - Add PooledObject<T> RAII wrapper for automatic return to pool - Add BufferPool<Size> for fixed-size char buffer pooling - Configurable max pool size (default 64 objects) Thread Pool & Async I/O: - Add src/core/thread_pool.hh with ThreadPool for async operations - Add WriteBehindBuffer for deferred writes - Add CloseAsync() for non-blocking printer operations - Add 5-second socket timeouts to prevent hangs Memory Management Improvements: - Convert Report* to std::unique_ptr<Report> in 8 zone files - Add O(1) Count() caching for DList/SList (was O(n)) - Add lazy texture loading with LRU cache in term_view - Reduce CharQueue default size from 2MB to 256KB - Add RemoveAndDelete() helpers for linked lists - Add RAII for KeyValueInputFile/KeyValueOutputFile Quick Fixes: - Cache term->GetSettings() pointer in hot paths - Fix socket leaks in socket.cc and loader_main.cc Target: Raspberry Pi CM5 with 2GB RAM optimization Tests: 83/83 passing
The lazy texture loading optimization conflicted with the static tile cache in Layer::Rectangle(), causing buttons to incorrectly show highlighted state. - Add PreloadAllTextures() function to load all textures at startup - Call PreloadAllTextures() after ResetView() during initialization - Ensures consistent Pixmap values before any rendering occurs
The static cache optimization in Layer::Rectangle() was fundamentally broken - static variables persisted across all rendering calls, causing stale cache values to be used when different buttons needed different textures. - Remove static current_tile, current_origin_x, current_origin_y cache - Each Rectangle() call now properly sets XSetTile and XSetTSOrigin - Ensures correct texture rendering for all button states
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses button highlighting issues and introduces memory efficiency optimizations targeted for the Raspberry Pi CM5.
Changes
fix: Remove broken static tile cache causing button highlighting bugs
The static cache optimization in Layer::Rectangle() was fundamentally broken - static variables persisted across all rendering calls, causing stale cache values to be used when different buttons needed different textures.
fix: Preload all textures to fix button highlighting bug
The lazy texture loading optimization conflicted with the static tile cache in Layer::Rectangle(), causing buttons to incorrectly show highlighted state.
perf: Add memory efficiency optimizations for Raspberry Pi CM5
Object Pool System:
Thread Pool & Async I/O:
Memory Management Improvements:
Quick Fixes:
Target: Raspberry Pi CM5 with 2GB RAM optimization
Tests: 83/83 passing
Testing
All tests pass (83/83). Manual testing on Raspberry Pi CM5 recommended for memory optimizations.