pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

`_sdl2.video.Window(maximized=True)` not starting in fullscreen in Hyprland + Arch Linux

Open blankRiot96 opened this issue 1 year ago • 3 comments
trafficstars

Environment:

pygame-ce 2.5.1 (SDL 2.30.6, Python 3.12.5)
Platform:               Linux-6.10.8-arch1-1-x86_64-with-glibc2.40
System:                 Linux
System Version:         #1 SMP PREEMPT_DYNAMIC Wed, 04 Sep 2024 15:16:37 +0000
Processor:                      SSE2: Yes       AVX2: Yes      NEON: No
Architecture:           Bits: 64bit     Linkage: ELF

Python:                 CPython 3.12.5 (main, Aug  9 2024, 08:20:41) [GCC 14.2.1 20240805]
pygame version:         2.5.1
SDL versions:           Linked: 2.30.6  Compiled: 2.30.6
SDL Mixer versions:     Linked: 2.8.0   Compiled: 2.8.0
SDL Font versions:      Linked: 2.22.0  Compiled: 2.22.0
SDL Image versions:     Linked: 2.8.2   Compiled: 2.8.2
Freetype versions:      Linked: 2.13.2  Compiled: 2.13.2

Display Driver:         x11 ( xwayland == True )
Mixer Driver:           pulseaudio

Current behavior: This is the code that works on other platforms, but not on Hyprland

import pygame
import pygame._sdl2.video

pygame.init()
win = pygame._sdl2.video.Window(resizable=True, maximized=True)
screen = win.get_surface()
pygame.print_debug_info()
clock = pygame.Clock()
while True:
    events = pygame.event.get()
    for event in events:
        if event.type == pygame.QUIT:
            raise SystemExit
    win.flip()

Expected behavior: It was supposed to start the window in fullscreen, but instead its a tiny window It works with the regular display API and pygame.FULLSCREEN flag

import pygame

pygame.init()
win = pygame.display.set_mode((500, 500), pygame.FULLSCREEN)
clock = pygame.Clock()
while True:
    events = pygame.event.get()
    for event in events:
        if event.type == pygame.QUIT:
            raise SystemExit
    win.fill("black")
    pygame.display.flip()

Steps to reproduce:

  1. Just run the snippet on Arch+Hyprland

Test code

import pygame
import pygame._sdl2.video

pygame.init()
win = pygame._sdl2.video.Window(resizable=True, maximized=True)
screen = win.get_surface()
pygame.print_debug_info()
clock = pygame.Clock()
while True:
    events = pygame.event.get()
    for event in events:
        if event.type == pygame.QUIT:
            raise SystemExit
    win.flip()

blankRiot96 avatar Oct 14 '24 12:10 blankRiot96

Maximized is not fullscreen. It just means the window is supposed to be the size of the window. There are fullscreen and fullscreen_desktop kwargs to choose and use. Reference docs in case you haven't seen it on the site: https://pyga.me/docs/ref/window.html

I'd be also interested to know what happens if you add a KEYDOWN -> win.maximize() call. Maybe it can't start maximized but could be maximized after creation on your platform.

Also we've just promoted pygame.Window to public API in 2.5.2.dev2, so please try with that. pygame._sdl2.video.Window is basically an old alias at this point.

Starbuck5 avatar Oct 15 '24 06:10 Starbuck5

Works as expected on Windows.

Starbuck5 avatar Oct 16 '24 07:10 Starbuck5

Worked as expected on arch + kde as well. This issue was caught using an old project of mine; I'll be swapping the alias shortly. The "maximised" behaviour is what I was after, specifically not full screen. At least not until I'm a lot further along in development and don't have to close the window so often. On hyprland it stays shrunk to whatever size is passed as.

JiffyRob avatar Oct 31 '24 01:10 JiffyRob