Lazarus

Programming => Widgetset => GTK => Topic started by: mm7 on May 30, 2020, 06:50:02 pm

Title: migrating from GTK2 to GTK3
Post by: mm7 on May 30, 2020, 06:50:02 pm
Program was built on GTK2
I've set link target to GTK3
Compiled, linked successfully.

when run it fails with error:
GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

nm also shows tons of GTK2 symbols

How to find and migrate them?

Title: Re: migrating from GTK2 to GTK3
Post by: dsiders on May 30, 2020, 07:41:26 pm
Program was built on GTK2
I've set link target to GTK3
Compiled, linked successfully.

when run it fails with error:
GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

nm also shows tons of GTK2 symbols

How to find and migrate them?

You said "Compile"... did you try "Build" or "Cleanup and Build" to force all units to be compiled?
Title: Re: migrating from GTK2 to GTK3
Post by: lucamar on May 30, 2020, 09:14:21 pm
Note also that the whole dependency tree must be built for GTK3 (LCL, etc.); otherwise you might end up with a GTK3 application using (trying to use) GTK2 controls.
Title: Re: migrating from GTK2 to GTK3
Post by: wp on May 30, 2020, 11:57:07 pm
For compiling an application to a different widgetset on Linux I go to "Project Options" > "Additions and Overrides". Then, depending on whether I want to store the widgeset used in the project or session file (lpi vs lps) I click in line "Stored in project (.lpi)" or "Stored in session of project (.lps)", click "Set LCL WidgetType" and check the widgettypes that I want to support. Of course, the dependent libraries must have been set up for each widgetset.

This can be combined with Build Modes to make switching from WS to WS very easy.

The first compilation run after changing WS will take longer because all used units must be rebuilt for the new WS.
Title: Re: migrating from GTK2 to GTK3
Post by: mm7 on May 31, 2020, 03:55:53 pm
I've done all of this. Done "Cleanup and Build". Same story. Binary includes GTK2.
New Application in built for GTK3 works well.

I will postpone to migrate. Not all features implemented yet. I.e. TShellListView ViewStype is only vsReport.
And it does not show file icons.
Title: Re: migrating from GTK2 to GTK3
Post by: mm7 on July 14, 2020, 04:07:27 am
yes, I've found GTK2 units are referenced.
Disabled that.
This can be closed.

However I've found a bug when tried any control with a scrollbar. When I scroll by wheel it fails with SIGSEGV because it receives GDK_SCROLL_SMOOTH event that is not processed correctly.
I'll post a bug.
TinyPortal © 2005-2018