Can (not) set window position on Ubuntu Linux

Discuss GUI programming with the RapaGUI plugin here
Post Reply
djg
Posts: 29
Joined: Wed Feb 12, 2020 10:37 pm

Can (not) set window position on Ubuntu Linux

Post by djg »

I have Ubuntu Linux running on my PC and on my laptop, both Ubuntu 24.04 LTS.

You'd think I like Linux, but I think it is a terribly complicated mess. (On the other hand it allows me to browse the internet with older hardware).

On the laptop I can set the window position of a RapaGUI window, but on the PC I can't. Setting width and height works on both.
So I start hunting for the cause and it seems it's because the laptop runs x11 and the PC runs Wayland. I have very little knowledge about what they are and what they do. It seems Wayland is newer and is being developed, and x11 is not.
(A tool called xdotool which can be used to get the mouse location or move a window for instance also only works on the laptop.)

Is there a way to get it to work using this Wayland thing as well?
User avatar
airsoftsoftwair
Posts: 5930
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Can (not) set window position on Ubuntu Linux

Post by airsoftsoftwair »

djg wrote: Sun Mar 08, 2026 6:16 pm Is there a way to get it to work using this Wayland thing as well?
The next version of RapaGUI will use a more recent version of wxWidgets so maybe this can fix things. If you post an MCVE, I can check if it works with the latest wxWidgets when I get back to working on RapaGUI.
djg
Posts: 29
Joined: Wed Feb 12, 2020 10:37 pm

Re: Can (not) set window position on Ubuntu Linux

Post by djg »

Code: Select all

@REQUIRE "rapagui", { link = True }

Function p_EventHandler(msg)
	Switch(msg.Action)	
	Case "RapaGUI":
		Local x = Rnd(1000)
		Local y = Rnd(800)
		Local w = 200 + Rnd(200)
		Local h = 100 + Rnd(100)
		moai.Set("rapawindow", "left", x)
		moai.Set("rapawindow", "top", y)
		moai.Set("rapawindow", "width", w)
		moai.Set("rapawindow", "height", h)
		DebugPrint("left:", x, moai.Get("rapawindow", "left"))
		DebugPrint("top:", y, moai.Get("rapawindow", "top"))
		DebugPrint("width:", w, moai.Get("rapawindow", "width"))
		DebugPrint("height:", h, moai.Get("rapawindow", "height"), "\n")
	EndSwitch
EndFunction

moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
	<window id="rapawindow" title="RapaGUI_Window" left="500" top="800" width="400" height="200">
		<vgroup>
			<rectangle/>
			<button id="button">Jump!</button>
			<rectangle/>
		</vgroup>
	</window>
</application>
]])

InstallEventHandler({ RapaGUI = p_EventHandler })

Repeat
	WaitEvent
Forever
Window position is set correctly with x11, but not with Wayland, although it does appear to return the new values.
An executable of this for AmigaOS4 compiled under Linux does not work well at all here either. A new window appears for an instant and then disappears and after that the new window appears again but not with the new position. I may be doing something wrong but thought I'd better post this before looking into that.
Post Reply