Recent

Author Topic: Lazarus Main and Gnome/Wayland  (Read 1393 times)

zeljko

  • Hero Member
  • *****
  • Posts: 1982
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazarus Main and Gnome/Wayland
« Reply #15 on: June 06, 2026, 05:48:44 pm »
You can install trunk lazarus by using fpcupdeluxe into it's local folder (your system installation won't be touched), so than you can rebuild lazarus for gtk3 and use it.

dbannon

  • Hero Member
  • *****
  • Posts: 3846
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus Main and Gnome/Wayland
« Reply #16 on: June 07, 2026, 04:54:01 am »
Yeah, Jonax, I understand it can be challenging. But working in a VM is a good idea, at least you can just throw it away when its completely messed up.

My advice with this test is that a Gnome desktop VM works OK with 4gig ram and two cpus. VirtualBox will probably suggest only 2Gig ram and one CPU and it will work, but not responsively.

My suggested short list of commands will make a reasonably isolated Lazarus install on your main system. It will not interfere with your existing one and might be a better bet if you cannot assign the necessary hardware to the VM.

You could, of course use that same list of commands on a VM. Further, if you have the disk space, making a clean and up to date VM then cloning it to make another one to mess around with is efficient use of time and network bandwidth.

Davo

Lazarus 4, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

paweld

  • Hero Member
  • *****
  • Posts: 1676
Re: Lazarus Main and Gnome/Wayland
« Reply #17 on: June 07, 2026, 10:28:31 am »
If I’m using Linux on a VM, it’s Debian (currently the testing branch) with XFCE (X11). Lazarus works well on this setup - I’ve been using GTK3 for a few weeks now, and GTK2 before that. I always work with the Lazarus trunk version (always up to date) + FPC 3.2-fixes (also up to date).
I installed an additional DE on this distribution to see what Lazarus GTK3 looks like.

And unfortunately, when using a non-docked IDE in Wayland, you have to disable the “Automatically adjust IDE main window height” option and get annoyed that the windows reset to the center every time you launch them - although with Cinnamon Wayland (currently an experimental version), there is hope that it will work properly in the future - windows position themselves from the top-left corner of the screen, and the position of the main window (with the menu and component palette) is remembered.

For a docked window, it works well on every DE, whether in X11 or Wayland.

During testing, I performed several basic operations in the IDE (dropping components onto a form, resizing components, automatically generating events, and entering simple code into them).

Screenshots: https://brudnopis.ovh/lazarus_gtk3/
Best regards / Pozdrawiam
paweld

Jonax

  • Jr. Member
  • **
  • Posts: 55
    • Jonax stuff
Re: Lazarus Main and Gnome/Wayland
« Reply #18 on: June 07, 2026, 11:40:29 am »
Yeah, Jonax, I understand it can be challenging. But working in a VM is a good idea, at least you can just throw it away when its completely messed up.

My advice with this test is that a Gnome desktop VM works OK with 4gig ram and two cpus. VirtualBox will probably suggest only 2Gig ram and one CPU and it will work, but not responsively.

My suggested short list of commands will make a reasonably isolated Lazarus install on your main system. It will not interfere with your existing one and might be a better bet if you cannot assign the necessary hardware to the VM.

You could, of course use that same list of commands on a VM. Further, if you have the disk space, making a clean and up to date VM then cloning it to make another one to mess around with is efficient use of time and network bandwidth.

Davo

Davo, indeed the VMs are mighty useful. For the tests I spawn brand new VMs. In this case Debian 13 with Gnome. I do have a pretty low end PC but fortunately I loaded it with decent RAM and SSD before the memory cost went ballistic. So 8 GB RAM is what I use to give the VMs and there's room on the SSD to have a few of them. Also I use the QEMU/KVM for the VMs. I have hear about VirtualBox but is not familar with it. That said, the previous VMs are now deleted and I start a new one with the horrible but apparently popular GNOME for a new attempt. So what are we aiming for here? The Lazarus 4.6 for GTK3? Or the Lazarus Trunk for GTK3?

zeljko

  • Hero Member
  • *****
  • Posts: 1982
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazarus Main and Gnome/Wayland
« Reply #19 on: June 07, 2026, 12:19:20 pm »
@Jonax ONLY Lazarus trunk for gtk3 (Lazarus 5.0 will be gtk3 based)

Jonax

  • Jr. Member
  • **
  • Posts: 55
    • Jonax stuff
Re: Lazarus Main and Gnome/Wayland
« Reply #20 on: June 07, 2026, 05:37:09 pm »
OK. So I spawned a new VM. Debian 13 with Gnome and Wayland. After some troubles the installation of Trunk with GTK2 succeeded. The top bar keeps misbehaving in Gnome on Wayland. I tried building the GTK3 Lazarus but there was some glitch. Is probably just some failed setting which I could adjust if I knew where to look. I agree with the opinion that Lazarus on Gnome is not very beginner friendly.

Here a screenshot of the attempt to build with GTK3.

zeljko

  • Hero Member
  • *****
  • Posts: 1982
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazarus Main and Gnome/Wayland
« Reply #21 on: June 07, 2026, 06:03:18 pm »
sudo apt install libgtk-3-dev and then try again to build it.
EDIT: some other devel packages are needed too: libcairo2-dev libpango1.0-dev libgdk-pixbuf-2.0-dev and libglib2.0-dev ... just install all of them and you're good to go.
« Last Edit: June 07, 2026, 06:05:47 pm by zeljko »

Jonax

  • Jr. Member
  • **
  • Posts: 55
    • Jonax stuff
Re: Lazarus Main and Gnome/Wayland
« Reply #22 on: June 07, 2026, 07:47:39 pm »
Thanks zeljko, that did it!

Build and compile of a Hello Gnome successful. Here comes the inital position.
The Top part seems to behave, at least as well as the other parts, so far. Will test more later.


zeljko

  • Hero Member
  • *****
  • Posts: 1982
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazarus Main and Gnome/Wayland
« Reply #23 on: June 07, 2026, 08:10:05 pm »
Great ! Now you're using gtk3 lazarus IDE :) , pls report any bugs

dbannon

  • Hero Member
  • *****
  • Posts: 3846
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus Main and Gnome/Wayland
« Reply #24 on: June 08, 2026, 06:04:30 am »
Just tested on Trixie KDE, interestingly no sign of that background bug in the toolbar.  Every thing seems to work as expected, except, of course, the Wayland non-sense of all windows opening in the middle of the screen. But we can get used to that easily enough.

(Personally, I'd use Qt6 to be honest, we can divert that to xcb. Anyone listening in, yes, you can build gtk3 apps in a Qt6 Lazarus IDE !)

Is it worth considering "hard wiring" Qt5 and Qt6 Lazarus to use xcb as per https://forum.lazarus.freepascal.org/index.php/topic,74009.15.html

I have done that in my app and it works flawlessly.
https://github.com/tomboy-notes/tomboy-ng/blob/master/source/qtWorkAround.pas

Davo
Lazarus 4, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

robert rozee

  • Sr. Member
  • ****
  • Posts: 400
Re: Lazarus Main and Gnome/Wayland
« Reply #25 on: June 08, 2026, 08:57:55 am »
[...] I totally agree the laz 4.xx gtk3 is unuseable (alpha status) [...]

it is a pity we can not figure out a tidy way to produce dual-mode ELF binaries that can select between GTK2 and GTK3 at run-time. i do have a method using bdiff/bpatch, but it is far from 'tidy'!


cheers,
rob   :-)
« Last Edit: June 08, 2026, 05:18:07 pm by robert rozee »

Jonax

  • Jr. Member
  • **
  • Posts: 55
    • Jonax stuff
Re: Lazarus Main and Gnome/Wayland
« Reply #26 on: June 09, 2026, 04:28:14 am »
Update:

Adjusting the panels' sizes in Gnome was not totally satsisfactory. This was the best I could do. It behaves better on KDE. Also Gnome in VM on my intel N200 is pretty sluggish. Not a very pleasing experience on my system. Apart from not begin used to Gnome.

As for error reports? I don't want to hijack the thread but there is one issue.

The output from screen.pixelsperinch seems stuck on 96 even if I use that high resolution setting in the Linux system. For example in 125% I still get 96 instead of expected 120.

Thaddy

  • Hero Member
  • *****
  • Posts: 19398
  • Glad to be alive.
Re: Lazarus Main and Gnome/Wayland
« Reply #27 on: June 09, 2026, 08:53:32 am »
@Jonax

Which vm do you use? WSL2 vm's run native speed because wsl2 uses hyperv - near native for GUI - and an N200 with windows10 or 11 would have little if any speed penalty if N200 supports it. (Although I also have a machine where the BIOS prohibits hyperv use, while the processor supports it, an old HP laptop)

Otherwise, use Virtualbox, I am advised. That uses VT-x.
[edit] N200 does not support hyperv, so wsl2 does not work, wsl1 will,
But at least Virtualbox does support VT-x.
« Last Edit: June 09, 2026, 09:04:31 am by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

zeljko

  • Hero Member
  • *****
  • Posts: 1982
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazarus Main and Gnome/Wayland
« Reply #28 on: June 09, 2026, 09:06:57 am »
Update:

Adjusting the panels' sizes in Gnome was not totally satsisfactory. This was the best I could do. It behaves better on KDE. Also Gnome in VM on my intel N200 is pretty sluggish. Not a very pleasing experience on my system. Apart from not begin used to Gnome.

As for error reports? I don't want to hijack the thread but there is one issue.

The output from screen.pixelsperinch seems stuck on 96 even if I use that high resolution setting in the Linux system. For example in 125% I still get 96 instead of expected 120.

What is the value of DesignTimePPI of your designed TForm ? Unlikely, but gtk3 can work with GDK_SCALE=2 and dpi 96 (depends on your setup), so you'll see scaled everything even with 96 dpi.

Jonax

  • Jr. Member
  • **
  • Posts: 55
    • Jonax stuff
Re: Lazarus Main and Gnome/Wayland
« Reply #29 on: June 09, 2026, 07:41:11 pm »
@Jonax

Which vm do you use? WSL2 vm's run native speed because wsl2 uses hyperv - near native for GUI - and an N200 with windows10 or 11 would have little if any speed penalty if N200 supports it. (Although I also have a machine where the BIOS prohibits hyperv use, while the processor supports it, an old HP laptop)

Otherwise, use Virtualbox, I am advised. That uses VT-x.
[edit] N200 does not support hyperv, so wsl2 does not work, wsl1 will,
But at least Virtualbox does support VT-x.

Thaddy. Nowadys I mostly use Debian Linux with Non-Gnome desktop environments.. Though back when I used windows I used the excellent Hyper-V. Windows has many benefits but unfortunately Windows is not very accepting with unknown exe-files. Righly so of course, but I try the path of coding for Linux/Debian and also make programs which runs well in virtual machines. To make it possible for users to test my programs without being afraid of compromising their system.  Anyway here a screenshot of the system for the current GNOME test VM. My feeling is that the GNOME is slower on my system but I haven't ran any tests. It's all a matter of taste and I'm not yet used the GNOME so will probably not use it much in the future.


 

TinyPortal © 2005-2018