Recent

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

megatron

  • Newbie
  • Posts: 2
Problem with gtk3 when compile empty app
« on: June 30, 2020, 08:43:30 pm »
Problem with gtk3 when compile empty app
« Last Edit: June 30, 2020, 08:52:56 pm by megatron »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Problem with gtk3 when compile empty app
« Reply #1 on: June 30, 2020, 11:32:38 pm »
On Windows, afaik IUNknown is stdcall. So this probably never has been used on windows.

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #2 on: July 01, 2020, 02:22:47 am »
Are you cross compiling or  trying to build a gtk3 windows app ?

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

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Problem with gtk3 when compile empty app
« Reply #3 on: July 01, 2020, 09:20:10 am »
On Windows, afaik IUNknown is stdcall. So this probably never has been used on windows.

It would be enough to remove the calling conventions from the implementation. It's correct in the interface part of TGtk3Widget. Probably using Code Completion let to the addition of only the cdecl in the implementation.

megatron

  • Newbie
  • Posts: 2
Re: Problem with gtk3 when compile empty app
« Reply #4 on: July 01, 2020, 12:40:13 pm »
Are you cross compiling or  trying to build a gtk3 windows app ?

Davo


trying build a gtk 3 window app only

i work with gtk2 without any problem

but i am try to build app with gtk3

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: Problem with gtk3 when compile empty app
« Reply #5 on: July 01, 2020, 02:38:06 pm »
why do you need gtk in windows?

Thaddy

  • Hero Member
  • *****
  • Posts: 14168
  • Probably until I exterminate Putin.
Re: Problem with gtk3 when compile empty app
« Reply #6 on: July 01, 2020, 02:52:07 pm »
why do you need gtk in windows?
Whereas it it usually recommended to use the default look for the OS, it can be the case that one wants to have the same look across all platforms. (E.g. games, sometimes corporate, etc)
This is not uncommon.
« Last Edit: July 01, 2020, 02:55:33 pm by Thaddy »
Specialize a type, not a var.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Problem with gtk3 when compile empty app
« Reply #7 on: July 01, 2020, 02:59:12 pm »
why do you need gtk in windows?
Whereas it it usually recommended to use the default look for the OS, it can be the case that one wants to have the same look across all platforms. (E.g. games, sometimes corporate, etc)
This is not uncommon.

Apparently it is, if this is the first time it is compiled on Windows :-) The GTK3 port is half a decade old.

Thaddy

  • Hero Member
  • *****
  • Posts: 14168
  • Probably until I exterminate Putin.
Re: Problem with gtk3 when compile empty app
« Reply #8 on: July 01, 2020, 03:00:09 pm »
It would be enough to remove the calling conventions from the implementation. It's correct in the interface part of TGtk3Widget. Probably using Code Completion let to the addition of only the cdecl in the implementation.
One could use winapi instead of a specific convention, since that chooses the right calling convention for a platform and works not just on windows. Assumes 3.2.0 or higher.
Specialize a type, not a var.

Thaddy

  • Hero Member
  • *****
  • Posts: 14168
  • Probably until I exterminate Putin.
Re: Problem with gtk3 when compile empty app
« Reply #9 on: July 01, 2020, 03:04:12 pm »
Apparently it is, if this is the first time it is compiled on Windows :-) The GTK3 port is half a decade old.
I never used GTK3, but there are many GTK2 applications available on Windows for the reasons I mentioned.
(isn't Blender one of those? and how about the mingw interface? Just to name two)

The point I try to make is not related to GTK3, but to any portable widgetset.
 
« Last Edit: July 01, 2020, 03:08:02 pm by Thaddy »
Specialize a type, not a var.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Problem with gtk3 when compile empty app
« Reply #10 on: July 01, 2020, 09:59:53 pm »
It would be enough to remove the calling conventions from the implementation. It's correct in the interface part of TGtk3Widget. Probably using Code Completion let to the addition of only the cdecl in the implementation.
One could use winapi instead of a specific convention, since that chooses the right calling convention for a platform and works not just on windows. Assumes 3.2.0 or higher.

The code is older than 3.2.0 and Lazarus supports the last two releases. Also the IInterface methods are declared the same way and one likely will simply copy these to implement them.

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problem with gtk3 when compile empty app
« Reply #11 on: July 02, 2020, 03:17:36 am »
But seriously, why use GTK3 on Windows ?

GTK3 on Linux has a long way to go, my guess is its far worse on Windows ?  megatron, perhaps you are not aware of the usual way to make cross platform apps ?   if you leave the default setting in place, Lazarus will use the local default widgetset, so, on Linux it will use GTK2 (which is pretty good, stable, widely supported) and on Windows will use the Win32 widgetset, again, just what you want on Windows.

If you want to help track down the GTK3 issues (and more power to your strong right arm) then you would find Linux a much friendly place to do so.

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

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Problem with gtk3 when compile empty app
« Reply #12 on: July 02, 2020, 11:14:26 am »
Apparently it is, if this is the first time it is compiled on Windows :-) The GTK3 port is half a decade old.
I never used GTK3, but there are many GTK2 applications available on Windows for the reasons I mentioned.

Gtk3widgets is in the lcl\interfaces\gtk3 dir. We are talking about the Lazarus GTK3 interface here, not about a hypothetical GTK3-only application.

And there is not much reason  to use that on Windows, since a proper Lazarus win32 interface is available, which is evident since it doesn't even compile.

Quote
The point I try to make is not related to GTK3, but to any portable widgetset.

Most of those applications have gtk on Windows because they are hardcoded to GTK and thus are condemned to it. It is not a choice but a result of the lack of choice.

Thaddy

  • Hero Member
  • *****
  • Posts: 14168
  • Probably until I exterminate Putin.
Re: Problem with gtk3 when compile empty app
« Reply #13 on: July 02, 2020, 01:04:03 pm »
Most of those applications have gtk on Windows because they are hardcoded to GTK and thus are condemned to it. It is not a choice but a result of the lack of choice.
So we agree?  ;D
Specialize a type, not a var.

prof7bit

  • Full Member
  • ***
  • Posts: 161
Re: Problem with gtk3 when compile empty app
« Reply #14 on: September 25, 2021, 01:49:22 pm »
Apparently it is, if this is the first time it is compiled on Windows :-) The GTK3 port is half a decade old.
I never used GTK3, but there are many GTK2 applications available on Windows for the reasons I mentioned.
(isn't Blender one of those? and how about the mingw interface? Just to name two)

The only reason for these applications to use GTK on Windows is because they have originally been developed on *ix against one particular GUI framework (GTK2 in that case) and only later been ported to Windows. At this point the developers realized that it was a mistake to develop directly against GTK instead of using one of the available abstractions like LCL for Pascal programmmers (or wxWidgets if they are using C++) and then they were forced to ship their application along with a complete copy of GTK.

The approach of Lazarus/LCL (and other similar abstraction layers) is to always use the native Widgetset on the target-OS and abstract away the differences for the programmer. So you don't have to ship an entire GUI framework with your app and your app will have native look and feel.

If you plan to be cross platform from the beginning on you should use LCL (if you are using ObjectPascal) or wxWidgets if you are using C++ and let the abstraction do its magic. With some experience you can work around those few corner cases where the native platform behavior is still shining through and causing subtle differences, you will still need some testing and tweaking on all target platforms but it is manageable and 99% will just work out of the box.

And Blender isn't really using GTK, they have their very own completely customdrawn widgetset running directly on top of OpenGL. A customdrawn widgetset is another approach you can use if you really want it to look and behave exactly the same everywhere and want to have full control over the appearance, like it is the case in Blender where all their tiny widgets and special gizmos in the UI don't even exist in any of the large GUI frameworks and are all handcrafted anyways.
« Last Edit: September 25, 2021, 01:59:33 pm by prof7bit »

 

TinyPortal © 2005-2018