Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Disable Compositor-Enforced Scaling on Wayland Using GLFW #347

Open
Atraxus opened this issue Dec 19, 2024 · 0 comments
Open

Unable to Disable Compositor-Enforced Scaling on Wayland Using GLFW #347

Atraxus opened this issue Dec 19, 2024 · 0 comments
Assignees
Labels
A-ui Area: User interface for rendering and more C-bug Category: Something isn't working correctly

Comments

@Atraxus
Copy link
Collaborator

Atraxus commented Dec 19, 2024

Describe the bug
GLFW incorrectly applies or reports scaling factors under certain Linux compositors, particularly when running under Wayland. Even after explicitly disabling scaling hints using glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE) and glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE), GLFW continues to enforce compositor-level scaling, resulting in blurry or improperly scaled rendering. The main issue is not the scaling itself but the inability to effectively stop or bypass it.

To Reproduce
Steps to reproduce the behavior:

  1. Add the following hints to the GLFW initialization code:
    glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
    glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
  2. Launch the application on a Linux distribution using Wayland as the compositor.
  3. Observe that GLFW still applies scaling factors reported by glfwGetWindowContentScale (e.g., Scale: 1.5, 1.5).
  4. Note that the application appears blurry or improperly scaled despite the explicit attempt to disable scaling.

Expected behavior
GLFW should respect the hints to disable scaling, allowing the application to bypass compositor-level scaling and manage scaling internally.

Desktop (please complete the following information):

  • OS: [e.g., Arch Linux, Ubuntu 22.04]
  • Compositor: [e.g., Wayland]
  • GLFW Version: [e.g., 3.3.8]
  • Display: High-DPI or scaled display (e.g., 4K monitor with 150% scaling).

Additional context
Attempts to disable scaling using glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE) and glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE) have no effect. The problem is rooted in GLFW's inability to bypass compositor-enforced scaling, even when requested. While SDL reportedly handles this situation better, migrating from GLFW to SDL is a non-trivial task and deemed too resource-intensive for this minor inconvenience at the moment.

Future efforts may include:

  • Testing SDL to confirm it provides better control over scaling under Wayland.
  • Revisiting the decision to migrate if user experience is significantly impacted or GLFW provides no solution in future updates.

For now, this issue is acknowledged but will not be fixed until a simpler resolution or greater necessity arises.

@Atraxus Atraxus added C-bug Category: Something isn't working correctly A-ui Area: User interface for rendering and more labels Dec 19, 2024
@Atraxus Atraxus self-assigned this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ui Area: User interface for rendering and more C-bug Category: Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

1 participant