Your repository contains files using different API versions that are incompatible with the working MojoGUI framework. The main issues are:
- Wrong library paths - Many files use
./libmojoguiglfw.soinstead of the correct path - Outdated syntax - Files using
def main():instead offn main() raises: - Old API patterns - Using float parameters instead of integer-only API
- Incorrect function names - Using old GLFW wrapper functions
I've created two fixed versions that demonstrate the correct patterns:
- ✅ Uses correct library path
- ✅ Modern Mojo syntax (
fn main() raises:) - ✅ Integer-only API calls
- ✅ Proper string handling
- ✅ Includes system color and text input functions
- ✅ Complete API testing
- ✅ All modern functions included
- ✅ Demonstrates working search functionality
- ✅ System color integration
# ❌ WRONG - Old library
var lib = DLHandle("./libmojoguiglfw.so")
# ✅ CORRECT - Modern library
var lib = DLHandle("./mojo-gui/c_src/librendering_primitives_int_with_fonts.so")# ❌ WRONG - Old syntax
def main():
# ✅ CORRECT - Modern syntax
fn main() raises:# ❌ WRONG - Old method
var text_ptr = text.data()
# ✅ CORRECT - Modern method
var text_bytes = text.as_bytes()
var text_ptr = text_bytes.unsafe_ptr().bitcast[Int8]()# ❌ WRONG - Old functions
var init_gui = lib.get_function[fn() -> Int32]("InitGUI")
var create_window = lib.get_function[fn(Int32, Int32, Pointer[UInt8]) -> Int32]("CreateWindow")
# ✅ CORRECT - Modern functions
var initialize_gl = lib.get_function[fn(Int32, Int32, UnsafePointer[Int8]) -> Int32]("initialize_gl_context")
var cleanup_gl = lib.get_function[fn() -> Int32]("cleanup_gl")# ❌ WRONG - Float parameters
var draw_set_color = lib.get_function[fn(Float32, Float32, Float32, Float32) -> None]("DrawSetColor")
# ✅ CORRECT - Integer parameters (0-255 range)
var set_color = lib.get_function[fn(Int32, Int32, Int32, Int32) -> Int32]("set_color")basic_functionality_test.mojo→ Usebasic_functionality_test_fixed.mojodirect_ffi_test.mojo→ Usedirect_ffi_test_fixed.mojomojo_gui_glfw.mojo→ Needs complete rewrite- Any file using
./libmojoguiglfw.so
- Files missing system color functions
- Files missing text input functions
- Files using old function names
adaptive_file_manager.mojo- Complete file manager with searchsystem_colors_demo.mojo- System color integrationbasic_functionality_test_fixed.mojo- Basic testingdirect_ffi_test_fixed.mojo- Complete API testing
cd mojo-gui/c_src
make# Test the main working applications
mojo adaptive_file_manager.mojo
mojo system_colors_demo.mojo
# Test the fixed versions
mojo basic_functionality_test_fixed.mojo
mojo direct_ffi_test_fixed.mojo- Run
mojo adaptive_file_manager.mojo - Click the search box (top-right)
- Type text - it should appear immediately
- Backspace should work for editing
adaptive_file_manager.mojo- Main demo with searchsystem_colors_demo.mojo- Color integrationbasic_functionality_test_fixed.mojo- Fixed testingdirect_ffi_test_fixed.mojo- Complete API test
basic_functionality_test.mojo- Use fixed version insteaddirect_ffi_test.mojo- Use fixed version instead- Most files in root directory using old API
- Files using
./libmojoguiglfw.so - Files using
def main(): - Files using float API calls
Focus on these confirmed working applications:
mojo adaptive_file_manager.mojo # Complete file manager
mojo system_colors_demo.mojo # Color integration demoTry the compatibility-fixed files:
mojo basic_functionality_test_fixed.mojo # Basic functionality
mojo direct_ffi_test_fixed.mojo # Complete API testUse the patterns from the fixed files to update other applications as needed.
Good News: Your main applications (adaptive_file_manager.mojo and system_colors_demo.mojo) work perfectly with the search functionality!
The Issue: Some older files use incompatible API patterns, but I've provided fixed versions that demonstrate the correct approach.
Solution: Use the working files as your main demonstrations, and refer to the fixed versions as templates for updating any other files you want to use.
Your search functionality works perfectly! 🔍✨