Recent

Author Topic: Problem with gtk3 when compile empty app  (Read 16716 times)

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Problem with gtk3 when compile empty app
« Reply #15 on: January 16, 2022, 03:51:21 am »
FWIW, though I'm well aware of general attitudes towards CodeTyphon here, this kind of thing is one area where they're noticeably ahead of base Lazarus. Which is to say, their current revision of the GTK3 widgetset just transparently compiles (and works properly) on Windows 10 (and presumably all other platforms.) They also already have a GTK4 version of the LCL well underway, seemingly.

I would go as far as to suggest there would be no downside to simply copying and pasting the entire CodeTyphon version of the GTK3 LCL into mainline Lazarus, considering that the Lazarus version doesn't even yet include the basic cross-platform defines that the CodeTyphon one has such as the following, anywhere:

Code: Pascal  [Select][+][-]
  1. {$IF DEFINED(WINDOWS)}
  2.   Gtk3_library = 'libgtk-3-0.dll';
  3. {$ELSEIF DEFINED(DARWIN)}
  4.   Gtk3_library = 'libgtk-3.dynlib';
  5. {$ELSE}
  6.   Gtk3_library = 'libgtk-3.so.0';
  7. {$ENDIF}
« Last Edit: January 16, 2022, 04:00:04 am by Akira1364 »

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #16 on: January 16, 2022, 04:25:13 am »
I put that in the same category as "wow, someone is going to ride a push bike across the Simpson Desert" !  It may be possible but why on earth would you do it ?

If the folks at CT are so hot with GTK3, I cannot but think their efforts would be more useful focusing on Unix platforms where GTK is a lot more comfortable !

(Honestly, I thought Gnome had given up with its 'portable' model with GTK2, but here it is, how to setup GTK3 on Windows, gee !

https://www.gtk.org/docs/installations/windows/

The page even has a real Windows look and feel. )

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

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Problem with gtk3 when compile empty app
« Reply #17 on: January 16, 2022, 04:35:55 am »
I put that in the same category as "wow, someone is going to ride a push bike across the Simpson Desert" !  It may be possible but why on earth would you do it ?

If the folks at CT are so hot with GTK3, I cannot but think their efforts would be more useful focusing on Unix platforms where GTK is a lot more comfortable !

(Honestly, I thought Gnome had given up with its 'portable' model with GTK2, but here it is, how to setup GTK3 on Windows, gee !

https://www.gtk.org/docs/installations/windows/

The page even has a real Windows look and feel. )

Davo

I'm not trying to be rude but like, what are you even talking about? My point was that:

A) CodeTyphon's GTK3 widgetset is not in any way an "alpha", on any platform, as Lazarus's is
B) Beyond completing it on non-Windows platforms, they also made it work properly (as it should) on Windows.

Say what you will about Codetyphon but one thing they are extremely good at is taking existing code and really properly refining it / re-structuring it so that it consistently works well in as many scenarios as possible.

In particular, none of their packages have the super-annoying problem often encountered in Lazarus whenever you attempt to build a package written by someone who fails to understand that Lazarus is not Delphi, and that you simply cannot have "runtime packages" and "design time packages" with units that overlap and live in the same folders without encountering weird PPU incompatibility problems.

They separate everything in the only way that actually reliably works in the overall "Lazarus unit / package system", which is: no two packages contain ANY of the same units, ever, and no package includes the unit folders of ANY other in its search directory. So "design time" packages just depend on "runtime" packages as a whole, without actually directly re-compiling the "runtime" units.
« Last Edit: January 16, 2022, 04:42:54 am by Akira1364 »

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #18 on: January 16, 2022, 04:44:26 am »
....
B) Beyond completing it on non-Windows platforms, they also made it work properly (as it should) on Windows.
...

OK, are you saying that CT has working GTK3 on, eg, Linux ?  Now, that would impress me, I missed your hint completely !

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

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Problem with gtk3 when compile empty app
« Reply #19 on: January 16, 2022, 04:52:27 am »
OK, are you saying that CT has working GTK3 on, eg, Linux ?  Now, that would impress me, I missed your hint completely !

As far as I can tell, yeah. I think they don't claim their IDE itself works completely flawlessly when built with it, but that user projects do. Testing several apps (on Windows) of mine, indeed everything does in fact work and look like any other GTK3 app out there, so I'd be surprised if it was somehow worse on Linux.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #20 on: January 16, 2022, 05:11:27 am »
Thats very interesting.

This -
https://www.pilotlogic.com/sitejoom/index.php/88-wiki/technical/400-what-is-platform.html

and this -
https://www.pilotlogic.com/sitejoom/index.php/forum/general-discussions/5402-gtk3.html
Quote
Sir
CodeTyphon has already GTK3 support for projects.
.....

Seems to be the only relevent mention of GTK3 on their entire website.

The first link is quite confusing, the second supports what you say in a very understated way. Further research is indicated !

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

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Problem with gtk3 when compile empty app
« Reply #21 on: January 16, 2022, 05:13:15 am »
Thats very interesting.

This -
https://www.pilotlogic.com/sitejoom/index.php/88-wiki/technical/400-what-is-platform.html

and this -
https://www.pilotlogic.com/sitejoom/index.php/forum/general-discussions/5402-gtk3.html
Quote
Sir
CodeTyphon has already GTK3 support for projects.
.....

Seems to be the only relevent mention of GTK3 on their entire website.

The first link is quite confusing, the second supports what you say in a very understated way. Further research is indicated !

Davo

I don't think they speak super proficient English TBH. I'm basing everything I'm saying off of just actually experimenting with CT in practice, to be clear (and also a few things that I've sort of interpreted from CT forum posts made by its developers).
« Last Edit: January 16, 2022, 05:15:17 am by Akira1364 »

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #22 on: January 16, 2022, 08:22:02 am »
Yep, I have to agree, CT appears to be doing GTK3 better than Lazarus.  Someone has been very busy, what a pity they have not pushed those improvements back to Lazarus where they started from !

Seriously, it does look pretty good !

A full review ?  A pretty ordinary installer, have to download a gig over a slow link, seems to bring all sorts of things down, binaries for every OS under the sun so it needs to be big. Then run an install, as root that you have no idea about what is happening. You have to install into root space even though we all know both FPC and Lazarus are happier in user land.

I installed into a VM, yeah, I'm a coward.

But i does all run, looks a lot like Lazarus (because it is Lazarus) but a very hard to use button bar apparently trying to show every menu item, quite confusing. But its configurable and you should be able to trim it down to fighting weight.

Apart from the buttonbar, it soon feels quite familiar except that you can, in fact, build GTK3 apps.  I will, when I get some time, try and build a bit more complicated one !

And we still get heaps of GTK3 critical errors on stderror ....

So, as   Akira1364 said, a full import anyone ?   :-[  :-[

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

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Problem with gtk3 when compile empty app
« Reply #23 on: January 16, 2022, 04:11:08 pm »
My 2 cents - I'm just a hobbyist. I ran into some problems with GTK2 and didn't like the QT alternative. So I've kinda put Lazarus on "pause" while I continue my hobby activity with wxWidgets / C++. It is encouraging that there is interest and activity in the area of getting some form of object Pascal to "talk" to GTK3.

EDIT: In fairness I really didn't understand qt5ct and the need for clDefault enough to get my apps to have a decent dark gtk theme. But things look a lot more nice and "gtk" now that I set all my widget colors to "clDefault" and qt5ct style to "gtk2".
« Last Edit: January 29, 2022, 10:22:22 pm by del »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Problem with gtk3 when compile empty app
« Reply #24 on: January 16, 2022, 10:24:41 pm »
So, as   Akira1364 said, a full import anyone ?   :-[  :-[
How big diff does it make? IIRC CodeTyphon has no public revision control system. If the diff is very big, it must be split into manageable and testable pieces.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: Problem with gtk3 when compile empty app
« Reply #25 on: January 16, 2022, 10:32:46 pm »
Quote
I would go as far as to suggest there would be no downside to simply copying and pasting the entire CodeTyphon version of the GTK3 LCL

We had changes in LCL GTK3 regarding MsgBoxes issues (Application.MessageBox, LCLIntf.MessageBox, MessageDialog, InputDialog....). Not sure Typhoon guys have our fixes. I will test again if needed.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #26 on: January 17, 2022, 12:13:10 am »
Well, assuming they have left the structure pretty much the same, we could graft back method by method. A couple of sdiff runs in order...

And, also assuming there are no licensing complications. Thats a given but better check I suppose.

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

El Salvador

  • Full Member
  • ***
  • Posts: 134
Re: Problem with gtk3 when compile empty app
« Reply #27 on: January 17, 2022, 12:19:27 pm »
Yep, I have to agree, CT appears to be doing GTK3 better than Lazarus.  Someone has been very busy, what a pity they have not pushed those improvements back to Lazarus where they started from !
I see it pretty tough, given the attitude of the codetyphon developers.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Problem with gtk3 when compile empty app
« Reply #28 on: January 20, 2022, 06:53:04 pm »
I copied their LCL-GTK3 sources on top of ours and looked at the diff. It is not much.
Some of the changes did not compile. A boolean was tested against a number for example.
They must have changed the binding code under their components/ca_libGTKv3. Lazarus has similar files under lcl/interfaces/gtk3/gtk3bindings. I did not copy or compare those files exactly. Could somebody else please do it?

The actual LCL-GTK3 code is in lcl/interfaces/gtk3.
The changes I saw there were WriteLn changed to DebugLn, some typecasts etc. minor tweaking which cannot explain big improvements at runtime.
I cleaned the DebugLns more, added license headers etc. and committed.

Yep, I have to agree, CT appears to be doing GTK3 better than Lazarus.
Please give an example where the CT version works better. I didn't test CT now much. Actually I was not able to install it as normal user. Installing as root caused some hassle later.
I followed instructions and added my user name to sudoers, yet the installer complained I don't have sudo rights.
Some years ago I was able to install with normal user if I remember right.
« Last Edit: January 20, 2022, 08:45:05 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #29 on: January 21, 2022, 12:11:03 am »
Juha, I just tried my GTK3 test projects against a week or so old trunk and again, more works than I expected.

But Radio buttons in a Radio Group box do not, strangly in a Group they are OK ???

Seems to be a lot of anchoring problems.

And a crash at exit, I traced down the guilting component behind that crash but don't remember whar I found  :(  but I will chase up some notes when I get some free time.

Do I understand you as saying you have committed the CT code to real Lazarus ?  I could test it against Main ?

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

 

TinyPortal © 2005-2018