Recent

Author Topic: Using GTK3 on Lazarus  (Read 750 times)

Handoko

  • Hero Member
  • *****
  • Posts: 4081
  • My goal: build my own game engine using Lazarus
Using GTK3 on Lazarus
« on: January 16, 2021, 03:28:04 pm »
Sorry to interrupt.

I'm not good in strategy nor predicting which one is the best for the future. I'm more interested to test GTK3 but I can't simply make a hello world test to work.

On the project options > Compiler Options > Additions and Overrides > I already set LCLWidgetType to gtk3. But I got a compile-time error: error while linking, cannot find -lgdk-3. I'm using Lazarus 2.0.10 on Ubuntu Mate 20.10, which I believe already fully supports GTK3.

I checked gdk-3 on Synaptic Package Manager, there is nothing called gdk-3. The most similar I can get is libgdk3.0-cil-dev, which I believe is not what it needs.

Can anyone tell me or at least give me link showing how to use GTK3 on Lazarus?

af0815

  • Hero Member
  • *****
  • Posts: 638
Re: Using GTK3 on Lazarus
« Reply #1 on: January 16, 2021, 03:43:30 pm »
I think it is the best

a ) It is defined what kind of systempackages need on a bare-metal debian/ubuntu to start with gtk3 (or gtk4) and also pushed in the wiki (maybe this is documentated yet, but where ?)
b ) A seperate thread is used for the questions and suceeses (maybe if there are)

regards
Andreas

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 924
Re: Using GTK3 on Lazarus
« Reply #2 on: January 16, 2021, 04:28:56 pm »
hello,
I checked gdk-3 on Synaptic Package Manager, there is nothing called gdk-3. The most similar I can get is libgdk3.0-cil-dev, which I believe is not what it needs.
on Ubuntu 20.04   libgdk-3 is in the package libgtk-3-dev (see attachment).
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

dbannon

  • Hero Member
  • *****
  • Posts: 1296
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Using GTK3 on Lazarus
« Reply #3 on: January 17, 2021, 03:31:47 am »

Hmm, good catch !  I have added a reference to libgtk-3-dev on to https://wiki.lazarus.freepascal.org/Installing_Lazarus_on_Linux

Davo

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

Handoko

  • Hero Member
  • *****
  • Posts: 4081
  • My goal: build my own game engine using Lazarus
Re: Using GTK3 on Lazarus
« Reply #4 on: February 20, 2021, 03:12:11 am »
I quickly tested GTK3, yes it works after added libgtk-3-dev. Thank you.

For the programs from the same source code compiled to GTK2 and GTK3, I didn't see any differences on their appearances. Unfortunately, TOpenGLContext hasn't support GTK3. I got a "this LCL widgetset/OS is not yet supported" compile-time error message.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3977
  • I like bugs.
Re: Using GTK3 on Lazarus
« Reply #5 on: February 20, 2021, 09:39:51 am »
I have a related question: Can anybody use the Lazarus IDE built with LCL-GTK3 on Linux or any other OS?
I can build and start it but there are many errors. WMSize loop as indicated by the screenshot. Most windows show only partially. The source editor window is empty.
This is strange because most test applications work OK. That is how I was able to test patches for LCL-GTK3.
I am testing with Manjaro Linux 64-bit + KDE, building Lazarus IDE with all debug flags.
I remember a comment in the past from somebody using a LCL-GTK3 IDE, but maybe I misunderstood. I cannot find it now.

[Edit] The same effect with debug flags off and optimization on.
« Last Edit: February 20, 2021, 09:48:08 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1020
Re: Using GTK3 on Lazarus
« Reply #6 on: February 20, 2021, 11:08:32 am »
How much correct is this roadmap about LCL-GTK3 development?
https://wiki.lazarus.freepascal.org/Roadmap#Widgetset_dependent_components


Interesting discussion about GTK's lack of backward-compatibility [even in major updates]:

[Lazarus] GTK 3.0
Jul 09, 2016; 8:16am
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-GTK-3-0-td4048926.html
https://davmac.wordpress.com/2016/07/05/why-do-we-keep-building-rotten-foundations/

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 924
Re: Using GTK3 on Lazarus
« Reply #7 on: February 20, 2021, 01:22:23 pm »
hello JuhaManninen ,
I have a related question: Can anybody use the Lazarus IDE built with LCL-GTK3 on Linux or any other OS?
I can build and start it but there are many errors. WMSize loop as indicated by the screenshot. Most windows show only partially. The source editor window is empty.
This is strange because most test applications work OK. That is how I was able to test patches for LCL-GTK3.
I am testing with Manjaro Linux 64-bit + KDE, building Lazarus IDE with all debug flags.
I remember a comment in the past from somebody using a LCL-GTK3 IDE, but maybe I misunderstood. I cannot find it now.
[Edit] The same effect with debug flags off and optimization on.
I am trying to build Lazarus LCL-GTK3 under Ubuntu 20.04.
I can't build it because i have errors on Delphicompat.pas file  on these two lines :
Code: Pascal  [Select][+][-]
  1. {$i uses.inc}
  2. //...
  3. {$i delphicompat.inc}  
  4.  
files not found !
in the folder  fpcupdeluxe/lazarus/components/lclextensions/include  there isn't a folder for gtk3 !
Friendly, J.P
« Last Edit: February 20, 2021, 01:25:07 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3977
  • I like bugs.
Re: Using GTK3 on Lazarus
« Reply #8 on: February 20, 2021, 02:47:21 pm »
LclExtensions is yet another issue. Apparently it has no support has support for GTK3 only in trunk.
However Lazarus IDE does not need it. I am able to build the IDE but it does not work.
« Last Edit: February 21, 2021, 03:22:24 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 924
Re: Using GTK3 on Lazarus
« Reply #9 on: February 20, 2021, 02:53:22 pm »
how can i build lazarus ide without lclextensions ?   flags ? options ?
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

El Salvador

  • New Member
  • *
  • Posts: 34
Re: Using GTK3 on Lazarus
« Reply #10 on: February 20, 2021, 03:12:54 pm »
Two solutions:
- Download and use Lazarus Trunk
- Download upstream sources https://github.com/blikblum/luipack/tree/master/lclextensions

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3977
  • I like bugs.
Re: Using GTK3 on Lazarus
« Reply #11 on: February 20, 2021, 03:34:12 pm »
how can i build lazarus ide without lclextensions ?   flags ? options ?
Run "make".
LclExtensions is in Lazarus sources only for the VirtualTreeView copy.
VirtualTreeView is used only for OPM. Just leave OPM out.
For testing LCL-GTK3 you should use Lazarus trunk which has improvements for it.
« Last Edit: February 20, 2021, 03:45:53 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 924
Re: Using GTK3 on Lazarus
« Reply #12 on: February 20, 2021, 03:51:50 pm »
ok thanks El Salvador & JuhaManninen, i will try Lazarus Trunk
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 924
Re: Using GTK3 on Lazarus
« Reply #13 on: February 21, 2021, 02:37:26 am »
i have succeeded to build gtk3 Lazarus IDE on Ubuntu 20.04 with Lazarus Trunk but there is a lot of problems when i run it   %) :

- No Menu
- Black background on some windows
- Vertical Lines on form background simple project.

see attachment

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

lindomar

  • Newbie
  • Posts: 3
Re: Using GTK3 on Lazarus
« Reply #14 on: February 22, 2021, 06:30:50 pm »
I'm using Windows 10, GTK2 works normal, but when I test with GTK 3 it gives the following error.

Code: [Select]
Compilar pacote LCL 2.0.10: Código saída 1, Erros: 6, Aviso: 9, Dicas: 67
gtk3widgets.pas(255,14) Warning: An inherited method is hidden by "GetPosition:LongInt;"
gtk3widgets.pas(296,14) Warning: An inherited method is hidden by "GetPosition:LongInt;"
gtk3widgets.pas(517,15) Note: Virtual method "InitializeWidget;" has a lower visibility (protected) than parent class TGtk3Widget (public)
gtk3widgets.pas(705,15) Note: Virtual method "InitializeWidget;" has a lower visibility (protected) than parent class TGtk3ToggleButton (public)
gtk3widgets.pas(912,28) Hint: Parameter "widget" not used
gtk3widgets.pas(912,66) Hint: Parameter "data" not used
gtk3widgets.pas(1080,7) Note: Call to subroutine "function GetDebugLogger:TLazLogger;" marked as inline is not inlined
gtk3widgets.pas(1283,7) Note: Call to subroutine "function GetDebugLogger:TLazLogger;" marked as inline is not inlined
gtk3widgets.pas(1286,5) Note: Call to subroutine "function GetDebugLogger:TLazLogger;" marked as inline is not inlined
gtk3widgets.pas(1312,3) Note: Local variable "ARect" is assigned but never used
gtk3widgets.pas(1402,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(1424,21) Hint: Local variable "MoveMsg" does not seem to be initialized
gtk3widgets.pas(1365,28) Hint: Parameter "AWidget" not used
gtk3widgets.pas(1459,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(1449,26) Hint: Parameter "AWidget" not used
gtk3widgets.pas(1477,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(1467,26) Hint: Parameter "AWidget" not used
gtk3widgets.pas(1556,23) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(1594,17) Hint: Local variable "MessE" does not seem to be initialized
gtk3widgets.pas(1563,26) Hint: Parameter "AWidget" not used
gtk3widgets.pas(398,33) Hint: Parameter "Params" not used
gtk3widgets.pas(391,33) Hint: Parameter "Params" not used
gtk3widgets.pas(1649,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(1689,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(1724,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(1728,19) Hint: Local variable "AStruct" does not seem to be initialized
gtk3widgets.pas(1784,4) Note: User defined: Currently TGtk3DeviceContext(Msg.DC).Translate(P) is creating incorrect offsets inside TPages for TLabel and maybe others
gtk3widgets.pas(132,49) Hint: Parameter "Event" not used
gtk3widgets.pas(1826,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(1838,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(146,26) Hint: Parameter "AWidget" not used
gtk3widgets.pas(1967,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(2059,6) Warning: User defined: workaround for GtkTreeView key bindings.Must find out what LCL does with     this keys.
gtk3widgets.pas(2097,21) Hint: Local variable "CharMsg" does not seem to be initialized
gtk3widgets.pas(1954,3) Note: Local variable "KeyCode" not used
gtk3widgets.pas(1955,3) Note: Local variable "AShiftState" not used
gtk3widgets.pas(2161,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(2277,3) Note: Local variable "R" not used
gtk3widgets.pas(2278,3) Note: Local variable "G" not used
gtk3widgets.pas(2279,3) Note: Local variable "B" not used
gtk3widgets.pas(2435,4) Note: User defined: Gtk3: Find a nice way to assign StyleContext
gtk3widgets.pas(89,31) Hint: Parameter "AValue" not used
gtk3widgets.pas(97,23) Hint: Parameter "AValue" not used
gtk3widgets.pas(2456,22) Error: Calling convention doesn't match forward
gtk3widgets.pas(92,14) Error: Found declaration: QueryInterface(constref TGuid;out <Formal type>):LongInt; StdCall;
gtk3widgets.pas(2465,22) Error: Calling convention doesn't match forward
gtk3widgets.pas(93,14) Error: Found declaration: _AddRef:LongInt; StdCall;
gtk3widgets.pas(2470,22) Error: Calling convention doesn't match forward
gtk3widgets.pas(94,14) Error: Found declaration: _Release:LongInt; StdCall;
gtk3widgets.pas(3216,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(3225,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(3234,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(3454,17) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(3825,65) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(4039,17) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(4063,48) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(4085,60) Warning: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(4407,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(4530,6) Note: User defined: to get this correct we must use TQtWidget.CreateFrom() for scrollbars
gtk3widgets.pas(4762,34) Warning: Local variable "AIter" does not seem to be initialized
gtk3widgets.pas(4774,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(5222,55) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(5223,50) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(5252,19) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(5261,26) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(5813,65) Warning: Local variable "Cell" does not seem to be initialized
gtk3widgets.pas(6016,28) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6016,72) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6017,31) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6018,25) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6019,25) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6020,36) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6021,30) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6021,83) Hint: Conversion between ordinals and pointers is not portable
gtk3widgets.pas(6077,17) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(6276,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(6502,64) Warning: Symbol "add_with_viewport" is deprecated: "since 3.8 use add"
gtk3widgets.pas(6565,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(6659,50) Warning: Symbol "add_with_viewport" is deprecated: "since 3.8 use add"
gtk3widgets.pas(6779,23) Hint: Local variable "MsgActivate" does not seem to be initialized
gtk3widgets.pas(6810,15) Hint: Local variable "Msg" does not seem to be initialized
gtk3widgets.pas(6888,48) Warning: Symbol "add_with_viewport" is deprecated: "since 3.8 use add"
« Last Edit: February 22, 2021, 08:32:53 pm by JuhaManninen »

 

TinyPortal © 2005-2018