Recent

Author Topic: migrating from GTK2 to GTK3  (Read 3597 times)

mm7

  • Full Member
  • ***
  • Posts: 193
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
migrating from GTK2 to GTK3
« 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?


dsiders

  • Hero Member
  • *****
  • Posts: 1045
Re: migrating from GTK2 to GTK3
« Reply #1 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?
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: migrating from GTK2 to GTK3
« Reply #2 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.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: migrating from GTK2 to GTK3
« Reply #3 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.

mm7

  • Full Member
  • ***
  • Posts: 193
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
Re: migrating from GTK2 to GTK3
« Reply #4 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.
« Last Edit: June 01, 2020, 06:27:05 am by mm7 »

mm7

  • Full Member
  • ***
  • Posts: 193
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
Re: migrating from GTK2 to GTK3
« Reply #5 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