Page 1 of 1

PB6.21, 6.3b2 RPi Wayland WindowX() and WindowY()

Posted: Sun Sep 21, 2025 8:37 am
by TassyJim
With my RPi and Wayland support enabled, Windows always start centered and WindowX() and WindowY() return zero.

Code: Select all

If OpenWindow(0, 10, 10, 300, 300, "Move me !", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
    Repeat
      Event = WaitWindowEvent()
      If event = #PB_Event_SizeWindow Or event = #PB_Event_MoveWindow
        Debug WindowX(0)
        EndIf
    Until Event = #PB_Event_CloseWindow
  EndIf
The code runs as expected until I enable Wayland Support.
I can move windows and they stay moved but I am unable to save their position and always restart centered.
Resize works OK.

Jim

Re: PB6.21, 6.3b2 RPi Wayland WindowX() and WindowY()

Posted: Fri Oct 10, 2025 2:06 pm
by Fred
Wayland's security model restricts window positioning:

In Wayland, client applications cannot arbitrarily know or control their window positions on screen
The compositor (window manager) has full control over window placement
This prevents malicious applications from:

Positioning windows to trick users (e.g., placing fake password dialogs over real ones)
Reading screen coordinates to infer what other applications are doing
Implementing keyloggers by positioning invisible windows over input fields

Detecting window moves in Wayland with GTK3 is challenging because Wayland doesn't expose window position information to applications.

I will update the doc to reflect this

Re: PB6.21, 6.3b2 RPi Wayland WindowX() and WindowY()

Posted: Sat Oct 11, 2025 1:02 am
by TassyJim
Thanks for the explanation Fred.

My application runs faster with Wayland but not being able to position the windows is not ideal.
I will have to reconsider the use of Wayland.

Thanks again