Window positioning in QT5 lazarus / 32-Linux ---------------------------------------------------------------------- HotShoe · 2025-06-24 15:48 I'm finishing up a program for Fedora Core, using QT5 widgets. All works well except that a couple of routines resize a form and move it to the right while displaying a new form to its left at position 1 (left:= 1). I have been fighting to get the windows to move for the better part of a day.  Resizing works fine, but moving the position of the form does not. The forms always open in the screen center, and cannot be moved programmatically. I wrote a simple test to move a form around and it worked fine. Then I realized that I was using QT5 in the Fedora program. Changing that to stock GTK2 fixed the problem with moving forms around. I am using a Ryzen 7 laptop with 16 G of memory and 2 1TB ssd's. This is Laz 3.6 installed using fpcupdeluxe and has been running flawlessly for many months. This Laz install is running on Fedora 42. To reproduce the problem, simply compile and run the attached test app. then change the widget set to gtk2 and run it again. Note that you need to have qt5pas installed. ---------------------------------------------------------------------- MarkMLl · 2025-06-24 20:07 Is your system X11 or Wayland? MarkMLl ---------------------------------------------------------------------- HotShoe · 2025-06-24 20:19 It's wayland, but I thought they had all of the form/window movement fixed. I'll try Xorg and see if it is wayland. Thanks, --- Jem ---------------------------------------------------------------------- zeljko · 2025-06-24 20:27 You have problem with Qt5 because it uses wayland, and gtk2 uses x11 because it doesn't know anything about wayland.Start your app with -platform xcb and you're good to go ---------------------------------------------------------------------- HotShoe · 2025-06-24 22:02 I'm not familiar with that switch (-platform xcb). It causes an error on my system when I try to run the compiled program with it. is that a compiler command? Thanks, --- Jem ---------------------------------------------------------------------- dbannon · 2025-06-25 05:37 Quote from: HotShoe on June 25, 2025, 12:02:43 amI'm not familiar with that switch (-platform xcb). It causes an error on my system when I try to run the compiled program with it. is that a compiler command? No Jem, its a switch to your compiled application. Only works with a Qt5 (and Qt6 ??) application, should be ignored by a gk2 app. But your gtk2 app may object to an unexpected command line switch ? Another possibility, I have been reading recently that Fedora has or will leave x11 out of its Gnome systems entirely, despite ample evidence Wayland is not ready yet, that probably means xcb too. Ubuntu doing the same thing apparently. They suggest (as I do) you use a more user friendly desktop, Mate, XFCe, etc instead of Gnome. Apparently KDE still has X11 support but for how long ? Davo ---------------------------------------------------------------------- HotShoe · 2025-06-25 07:25 You were both right. Obviously I mis-typed something when I added that switch to the command line. It does correct the problem in QT5. Thanks to both of you guys, that's a switch I will remember. --- Jem ---------------------------------------------------------------------- PascalDragon · 2025-06-25 20:35 Quote from: HotShoe on June 24, 2025, 10:19:17 pmIt's wayland, but I thought they had all of the form/window movement fixed. I'll try Xorg and see if it is wayland. No, placement of windows in Wayland is simply not supported. There is a lengthy merge request for a potential extension, but even then it is mainly intended for positioning windows relative to one another (from the same application). ---------------------------------------------------------------------- HotShoe · 2025-06-27 01:46 Thanks, I was told that had been fixed. Why are distros running head on into waylands arms when it is simply not as robust as X? I don't understand the logic. I know it's the future because of a much cleaner code base, but it doesn't have to be the future today. Sorry for the rant. --- Jem ---------------------------------------------------------------------- MarkMLl · 2025-06-27 06:41 Micro-rant entirely justified IMO. Only reason I raised the possibility was that a couple of days earlier I'd (elsewhere) seen something about programs being unable to restore their size at startup... or possibly the overall OS (i.e. including GUI management) being unable to do it on their behalf. However a lot of this boils down to a poor (badly documented and patchily implemented) interface between the widget set and the Window Manager: I have in the past encountered a situation where a program misbehaved on an RPi because the WM didn't handle text metrics properly. And then there's this... https://hackaday.com/2025/02/04/freedesktop- and-alpine-linux-looking-for-new-hosting/ MarkMLl ---------------------------------------------------------------------- HotShoe · 2025-06-27 20:55 Thanks Mark, I didn't know that had happened. I wrote an article a few years back that brought me a lot of hate mail. The truth sometimes hurts, but I felt that someone needed to sat it out loud. I'll probably regret it, but here's a link. It is not for the faint of heart or true free software zealots. https://www.perf-tek.com/linux.pdf The question becomes: would you buy a copy of Lazarus for a reasonable price? Yes I would. --- Jem ---------------------------------------------------------------------- dbannon · 2025-06-28 00:20 Quote from: HotShoe on June 27, 2025, 03:46:17 amThanks, I was told that had been fixed. Why are distros running head on into waylands arms when it is simply not as robust as X? I don't understand the logic. I know it's the future because of a much cleaner code base, but it doesn't have to be the future today. Sorry for the rant. I believe (?) that the big multinationals have an interest in minimizing the transition time between X11 and Wayland. They don't (generally) use things like Fedora and Ubuntu (on important kit), they use 'safe' distros like RedHat. So, their best strategy is to suggest Wayland be widely adopted in the "peoples linuxes", the bugs ironed out and the developers familiar with the API. And, in projects like RedHat/Fedora, a 'suggestion' from the big guys carries a lot of weight. As far as I can tell, its not exactly impossible to move a window under Wayland (except perhaps the main window), just massively harder. https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec- wl_surface-request-attach - I suspect it may involve compositor specific code and certainly require a better understanding of how Wayland works than most of us want to acquire. I don't see projects like https://github.com/X11Libre/xserver being widely acceted because it wont have that big business support, like it or not, Linux is dependent on big business's investment. Davo ---------------------------------------------------------------------- Fred vS · 2025-06-28 04:10 Quote from: dbannon on June 28, 2025, 02:20:58 amI don't see projects like https://github.com/X11Libre/xserver being widely acceted because it wont have that big business support, like it or not, Linux is dependent on big business's investment. Maybe or maybe not. ---------------------------------------------------------------------- MarkMLl · 2025-06-28 06:49 Quote from: dbannon on June 28, 2025, 02:20:58 amAs far as I can tell, its not exactly impossible to move a window under Wayland (except perhaps the main window), just massively harder. https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec- wl_surface-request-attach - I suspect it may involve compositor specific code and certainly require a better understanding of how Wayland works than most of us want to acquire. In another thread, somebody says that getting PrintScreen to work has to be done using PipeWire and this might possibly also be applicable here. I've not followed it up but am getting increasingly concerned by the modern tendency to pile protocol atop protocol simply because one of them provides some facility that the current developer /must/ /have/: PipeWire for Wayland, MQ (IIRC, or something similar) for Home Assistant, WebSockets for the Myford AI assistant and so on. At least "back in the day" the intention of that was to improve the accessibility of the server since the protocol had support libraries in just about every language, but these days the choice of usable languages seems to have degenerated to one of C++/Java/Rust with Python intended to make it usable by mortals. MarkMLl ---------------------------------------------------------------------- dbannon · 2025-06-28 07:51 Quote from: Fred vS on June 28, 2025, 06:10:34 amXLibre ? Maybe or maybe not. OK Fred, some will (honestly, I hope all will). But if your Mum asks you to install Linux on her computer, would you choose [Arch,Artix, OpenMandriva, Vipnix]. Say you live 250Km away, its going to be something just a bit more mainstream ? I am a bit unsure of what the tables there mean. For example, Ubuntu will not have "removed x11" from its repos ?  No, only from its flagsh*t, woops, flagship, Gnome distro. You can install Ubuntu Gnome then use apt to install XFCe, Mate etc that do need X11. So, it MUST still there in their repo. Just not present (nor can be used by) Gnome.  Don't forget, most packages in Ubuntu Repos, are imported from Debian with a name change. Debian could well be a XLibre supporter some time in the future but they do move very slowly. If they do, they would drag Ubuntu along, kicking and screaming ... Fred, I hope so, Wayland is designed to be harder, bigger, less functional. We don't need it. But the big guys (apparently) do. Davo ---------------------------------------------------------------------- Fred vS · 2025-06-28 12:39 Quote from: dbannon on June 28, 2025, 09:51:55 amOK Fred, some will (honestly, I hope all will). But if your Mum asks you to install Linux on her computer, would you choose [Arch,Artix, OpenMandriva, Vipnix]. Say you live 250Km away, its going to be something just a bit more mainstream ? Hello Davo. I definitely wouldn't recommend installing Wayland. If I had to help her via remote desktop (and RustDesk is my favorite), Wayland would be a disaster. RustDesk doesn't have a Wayland version, and all Wayland-compatible remote desktops perform very poorly. And for the gibberish, X11 is an old technology from the late 80s, the wheel is also an old invention. Should we use square wheels because it's newer? Wayland was created in 2008, and nothing works as it should because its design has been stupid from the beginning. Fre;D ---------------------------------------------------------------------- PascalDragon · 2025-06-28 14:14 Quote from: dbannon on June 28, 2025, 09:51:55 amFred, I hope so, Wayland is designed to be harder, bigger, less functional. We don't need it. But the big guys (apparently) do. It really depends. E.g. creating a window and just rendering into it is nicer than with X11 (I've done both for our software at work). If only there wouldn't be so many small yet significant, annoying bits I'd be more than happy to move to Wayland, but as it is now... ---------------------------------------------------------------------- HotShoe · 2025-06-28 16:41 I have never seen wayland. I have not had anything to do with it since it's development. That is because it didn't do any of the things that we have to have for day to day work. I have been inside of the X source. as I remember it was over 1 million lines of code that looked a lot like an old spaghetti dinner. It is a mess, but it works. It doesn't have the security that is needed for today's threats, but it works, and it works well enough to be reliable in any industry. As I said, I know the future is wayland or something like a cleaned up and more secure X. It would take a new team probably the better part of a year just to get familiar with where things are in the X source, and to get familiar with the writing styles of so many that came before them. I do hope that X stays around. --- Jem ---------------------------------------------------------------------- Fred vS · 2025-06-29 13:31 Quote from: PascalDragon on June 28, 2025, 04:14:37 pm-- creating a window and just rendering into it is nicer than with X11 (I've done both for our software at work). If only there wouldn't be so many small yet significant, annoying bits I'd be more than happy to move to Wayland, but as it is now... Don't worry, Xlibre plans to integrate HDR10 and other Wayland "plus" features. https://github.com/X11Libre/xserver/issues/269 (Sorry, but I think I've fallen in love with Xlibre, so, as a new convert, I'm preaching for my new church ) ---------------------------------------------------------------------- alanphys · 2025-08-21 09:22 Quote from: zeljko on June 24, 2025, 10:27:20 pmYou have problem with Qt5 because it uses wayland, and gtk2 uses x11 because it doesn't know anything about wayland.Start your app with -platform xcb and you're good to go Thanks @zeljko for this tip and also the other Wayland tips. For me the windows positioning is a deal breaker. Unfortunately Wayland handles font scaling on my dual screen setup better than X11 so this is a good workaround. The other problem I was having is that the tooltips and hints were also landing up in the middle of the screen. Sometimes not even on the same screen as the app. this solves that as well. Regards Alan