Skip to content

Add yad_check_x11() for Wayland compatibility#316

Open
mg-dev25 wants to merge 1 commit intov1cont:masterfrom
Mgdev-25:refactor/wayland-api
Open

Add yad_check_x11() for Wayland compatibility#316
mg-dev25 wants to merge 1 commit intov1cont:masterfrom
Mgdev-25:refactor/wayland-api

Conversation

@mg-dev25
Copy link
Contributor

@mg-dev25 mg-dev25 commented Dec 2, 2025

Add yad_check_x11() for Wayland compatibility

Adds a simple API for checking if running on X11. This follows the feedback on PR #314 about using the existing is_x11 variable instead of adding redundant is_wayland detection.

What changed

New yad_check_x11() function in main.c that exposes the internal is_x11 variable. Callers can use !yad_check_x11() for Wayland detection.

Files modified:

  • src/main.c - added the function
  • src/yad.h - added declaration
  • src/cpicker.c - warns and skips color picker on non-X11
  • src/print.c - skips mouse positioning on Wayland

Why

Some features need X11 and don't work on Wayland:

  • Color picker needs screen capture and pointer grab
  • Mouse positioning is compositor-controlled on Wayland

Instead of silently failing, these now check yad_check_x11() and either warn or gracefully skip the feature.

Testing

Tested on both X11 and Wayland sessions. Color picker shows warning on Wayland. Print dialog skips mouse positioning.

Adds a simple API for checking if running on X11 display server.
Used by cpicker.c and print.c to warn about or skip X11-only features.

Changes:
- Add yad_check_x11() in main.c returning the is_x11 variable
- Add declaration in yad.h
- cpicker.c: Warn and skip color picker on non-X11 (needs screen grab)
- print.c: Skip mouse positioning on Wayland (compositor-controlled)

Addresses feedback from PR v1cont#314 about simplifying Wayland detection.
@mg-dev25 mg-dev25 force-pushed the refactor/wayland-api branch from 2fa95e5 to 790d604 Compare December 2, 2025 09:48
@mg-dev25 mg-dev25 closed this Dec 7, 2025
@mg-dev25 mg-dev25 deleted the refactor/wayland-api branch December 7, 2025 10:52
@mg-dev25 mg-dev25 restored the refactor/wayland-api branch December 7, 2025 23:16
@mg-dev25 mg-dev25 reopened this Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant