Contributing¶
Thank you for your interest in contributing to gSlapper! This guide will help you get started.
Getting Started¶
- Fork the repository on GitHub
- Clone your fork:
- Create a branch for your changes:
Development Setup¶
See Building from Source for setup instructions.
Code Style¶
- C code follows K&R style with 4-space indentation
- GStreamer objects use
g_prefix (GLib naming) - Wayland objects use
wl_prefix - Static functions at file scope
- Global state in
global_statepointer - Thread communication via
wakeup_pipe
Making Changes¶
Adding New Features¶
- Plan your changes - Consider architecture and impact
- Update documentation - Add/update relevant docs
- Add tests - Create test scripts if applicable
- Test thoroughly - Test on different compositors and setups
Adding New IPC Commands¶
- Define command handler in
src/main.c'sprocess_ipc_commands()function - Parse command arguments from
cmd_linestring - Validate inputs and check state
- Implement command logic with thread safety in mind
- Send response via
ipc_send_response(client_fd, response) - Free command with
free(cmd->cmd_line)andfree(cmd)
See existing commands like set-transition or change for examples.
Adding New Transition Effects¶
- Add transition type to
transition_type_tenum - Implement transition function (similar to
update_transition()) - Update command parser in IPC
set-transitionhandler - Add command-line option parsing in
parse_command_line() - Test with automated and visual tests
Modifying Rendering Pipeline¶
- Locate rendering code in
render()function - Ensure EGL context is current before OpenGL calls
- Lock
video_mutexwhen accessingvideo_frame_dataortransition_state - Update vertex data with
update_vertex_data()for scaling changes
Testing¶
Basic Functionality¶
# Test video playback
./build/gslapper -v DP-1 /path/to/video.mp4
# Test image display
./build/gslapper -v DP-1 /path/to/image.jpg
# Test with IPC enabled
./build/gslapper -I /tmp/test.sock -o "loop" DP-1 video.mp4
Test Scripts¶
Run the included test scripts:
# Basic integration tests
./tests/test_basic.sh
# Memory safety tests (requires ASAN build or valgrind)
./tests/test_memory.sh
# Systemd service tests
./tests/test_systemd.sh
IPC Testing¶
# Start with IPC enabled
./build/gslapper -I /tmp/test.sock -vv -o "loop" DP-1 video.mp4
# From another terminal, test commands
echo "query" | nc -U /tmp/test.sock
echo "pause" | nc -U /tmp/test.sock
echo "resume" | nc -U /tmp/test.sock
Commit Guidelines¶
- Write clear commit messages - Explain what and why
- Keep commits focused - One logical change per commit
- Test before committing - Ensure changes work
- Update documentation - Keep docs in sync with code
Commit Message Format¶
Short summary (50 chars or less)
More detailed explanation if needed. Wrap at 72 characters.
Explain what the change does and why.
- Bullet points for multiple changes
- Reference issues if applicable
Pull Request Process¶
- Ensure your code works - Test on your system
- Update documentation - Keep docs current
- Write a clear PR description - Explain changes and motivation
- Reference issues - Link to related issues if applicable
- Wait for review - Be responsive to feedback
Areas for Contribution¶
- Bug fixes - Report and fix issues
- Performance improvements - Optimize rendering or memory usage
- New features - Add requested functionality
- Documentation - Improve docs and examples
- Testing - Add test coverage
- Code quality - Refactor and improve code
Reporting Issues¶
When reporting issues, please include:
- gSlapper version -
gslapper --versionor git commit - System information - OS, compositor, GPU
- Steps to reproduce - Clear reproduction steps
- Expected behavior - What should happen
- Actual behavior - What actually happens
- Logs - Output with
-vvflag if applicable
Questions?¶
Feel free to open an issue for questions or discussions about contributions.
License¶
By contributing, you agree that your contributions will be licensed under the MIT License.