gSlapper
v1.5.0
Development

Contributing

Thank you for your interest in contributing to gSlapper! This guide will help you get started.

Thank you for your interest in contributing to gSlapper! This guide will help you get started.

Getting Started

  1. Fork the repository on GitHub
  2. Clone your fork:
    git clone https://github.com/YOUR_USERNAME/gSlapper.git
    cd gSlapper
  3. Create a branch for your changes:
    git checkout -b feature/your-feature-name

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_state pointer
  • Thread communication via wakeup_pipe

Making Changes

Adding New Features

  1. Plan your changes - Consider architecture and impact
  2. Update documentation - Add/update relevant docs
  3. Add tests - Create test scripts if applicable
  4. Test thoroughly - Test on different compositors and setups

Adding New IPC Commands

  1. Define command handler in src/main.c's process_ipc_commands() function
  2. Parse command arguments from cmd_line string
  3. Validate inputs and check state
  4. Implement command logic with thread safety in mind
  5. Send response via ipc_send_response(client_fd, response)
  6. Free command with free(cmd->cmd_line) and free(cmd)

See existing commands like set-transition or change for examples.

Adding New Transition Effects

  1. Add the type to transition_type_t in inc/transition.h and its name to type_names in src/transition.c. The CLI and IPC parsers pick it up from there.
  2. Map it to a shape in transition_resolve(). Reuse an existing transition_shape_t with fixed parameters if you can (that is how left and center work).
  3. For a new shape, add a transition_shape_t value and a branch in shape_mask() in the transition fragment shader (create_transition_shader_program() in src/main.c). The mask returns 0 for the old image and 1 for the new one.
  4. Test with meson test -C build transition and python3 tests/check_transitions.py build/gslapper, adding a pixel check for the new type.

Modifying Rendering Pipeline

  1. Locate rendering code in render() function
  2. Ensure EGL context is current before OpenGL calls
  3. Lock video_mutex when accessing video_frame_data or transition_state
  4. Update vertex data with update_vertex_data() for scaling changes; the scale math lives in compute_quad_scale() (src/scaling.c) and is shared with the transition pass

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

  1. Ensure your code works - Test on your system
  2. Update documentation - Keep docs current
  3. Write a clear PR description - Explain changes and motivation
  4. Reference issues - Link to related issues if applicable
  5. 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 --version or 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 -vv flag if applicable

Release Process

The in-repo PKGBUILD and gslapper.install are the canonical templates for the AUR package; the AUR copies must stay identical to them.

For every release vX.Y.Z, in order:

  1. Bump the version in all three files: meson.build, PKGBUILD (pkgver), and flake.nix.
  2. Update gslapper.install:
    • Rewrite the "New in X.Y.Z" notes in post_upgrade for this release.
    • Keep the brand ASCII banner in both post_install and post_upgrade. It was lost from post_upgrade in the 1.4.0 update; do not lose it again.
  3. Commit to master, push, then create and push the annotated tag vX.Y.Z. The tag triggers the release workflow: per-distro builds (Ubuntu, Debian, Fedora), nfpm deb/rpm packaging, native Void XBPS builds for x86_64 glibc/musl, fresh-root install checks, and a GitHub Release with SHA256SUMS and SHA256SUMS-void. Confirm every job succeeds before continuing.
  4. After the tag exists, download https://github.com/Nomadcxx/gSlapper/archive/vX.Y.Z.tar.gz, put its sha256 into PKGBUILD sha256sums, and commit that to master. The tag's own tarball necessarily carries the previous hash; master is what the AUR template is copied from, so master must be correct.
  5. If linked libraries changed, update depends in PKGBUILD and the dependency lists in the release workflow (check with ldd build/gslapper; example: systemd-libs was added in 1.5.1 for libsystemd).
  6. Update the AUR package (ssh://aur@aur.archlinux.org/gslapper.git):
    • Copy PKGBUILD and gslapper.install from the repo.
    • Verify with a real build: makepkg -f must download the tag tarball, pass the checksum, and build.
    • Regenerate metadata: makepkg --printsrcinfo > .SRCINFO.
    • Commit and push. Never commit tarballs, pkg/, or src/.
  7. Verify the release is live: the AUR cgit .SRCINFO shows the new pkgver (the RPC API caches for a few minutes), and the GitHub Release lists the deb, rpm, both XBPS packages, the Void source archive, SHA256SUMS and SHA256SUMS-void assets.

Check Void packaging without releasing

Run gh workflow run release.yml --ref <branch> and inspect the gslapper-void-glibc and gslapper-void-musl artifacts. Dispatch runs create no release. The native recipe lives in packaging/void/; scripts/build-void-package.sh fills its version and checksum from the checked-out commit, then builds it with xbps-src from current void-packages master, which keeps the tree in step with the binary repository binary-bootstrap installs from. scripts/verify-void-package.sh installs the result in a fresh root and checks both executables.

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.

On this page