Recent

Author Topic: Getting widgetset version  (Read 3642 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8413
Re: Getting widgetset version
« Reply #15 on: October 11, 2022, 06:38:49 pm »
I suffer when I see all these (widget) dependencies problems (and msegui is there, giving his hand...  O:-))

Well, yes. And I've also seen subtle differences on input handling... particularly when attempting something fancy like an APL-style keyboard with lots of overstrikes. I forget the precise detail, but it was something like quirky support for keys which were positioned differently in the UK and US layouts.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dbannon

  • Hero Member
  • *****
  • Posts: 3358
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Getting widgetset version
« Reply #16 on: October 12, 2022, 01:41:54 am »
Ha ok, by curiosity, is it possible to run a Lazarus-GTK2 application on a distro that has GTK3 installed by default (like Debian 11) without the need to install all the GTK2 dependencies?

Definitely not. But just about every distro is still shipping with both GTK2 and GTK3 preinstalled in parallel. Ubuntu pushed out one of its short term, (21.10 ??) without GTK2 but it was, obviously install-able as a dependency, all 200Meg of it. But to our (ie LCL users) relief the next one had GTK2 back again. It was, I guess, an experiment. But (and I feel like Cato the Elder, "Carthage must be destroyed!") we will have to move to GTK3 at some time !
Quote from: winni
Code: Pascal  [Select][+][-]
  1. gtk-launch --version
I mentioned that further up, but as its GTK3 behavior, I could not find any gtk2 app that responded like that so it does not address mark's issue. The built in constants sounds much better option -
Code: Pascal  [Select][+][-]
  1. #include <gtk/gtk.h>
  2. #include <glib/gprintf.h>
  3. int main(int argc, char *argv[])
  4. {
  5.     /* Initialize GTK */
  6.     gtk_init (&argc, &argv);
  7.     g_printf("%d.%d.%d\n", gtk_major_version, gtk_minor_version, gtk_micro_version);
  8.     return(0);
  9. }
https://stackoverflow.com/questions/126141/how-do-you-find-out-which-version-of-gtk-is-installed-on-ubuntu

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

dbannon

  • Hero Member
  • *****
  • Posts: 3358
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Getting widgetset version
« Reply #17 on: October 12, 2022, 02:43:16 am »
I suffer when I see all these (widget) dependencies problems (and msegui is there, giving his hand...  O:-))

No, no, don't leave Fred, msegui looks great, I have though about it several time. But then I pick up my aging Mac test box ....

Like them or loath them, to cross platform really needs to include MacOS.

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

Fred vS

  • Hero Member
  • *****
  • Posts: 3601
    • StrumPract is the musicians best friend
Re: Getting widgetset version
« Reply #18 on: October 12, 2022, 11:00:57 am »
But then I pick up my aging Mac test box ....Like them or loath them, to cross platform really needs to include MacOS.

Hello Davo.

Yes, but I dont have a Mac and have zero knowledge about Mac OS X.

But the great news is that msegui is open-source and everyone is welcome to expand that wonderful 100% Pascal,, dependencies-free project.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

MarkMLl

  • Hero Member
  • *****
  • Posts: 8413
Re: Getting widgetset version
« Reply #19 on: December 10, 2022, 04:12:17 pm »
I'm doing some maintenance on the stuff I use to work out and display version numbers, hence am revisiting the code we were discussing a couple of months ago to find out the actual widget set version at runtime.

Aha! I was making the mistake of looking for it in Lazarus, forgetting the underlying files in FPC :-)

Code: Pascal  [Select][+][-]
  1. uses
  2.   gtk2, BaseUnix;
  3.  
  4. type
  5.   guint= cuint;
  6.  
  7. var
  8.   gtk_major_version : guint;cvar;external;
  9.   gtk_minor_version : guint;cvar;external;
  10.   gtk_micro_version : guint;cvar;external;
  11.  
  12. begin
  13.   WriteLn('GTK ', gtk_major_version, '.', gtk_minor_version, '.', gtk_micro_version, '.')
  14. end.
  15.  

So it there an equivalent to this for GTK3? Looking at the FPC sources I can't see a gtk3 package, and while I can compile the program I'm using to experiment for GTK3 I don't see a directly-equivalent interface structure.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dsiders

  • Hero Member
  • *****
  • Posts: 1423
Re: Getting widgetset version
« Reply #20 on: December 10, 2022, 05:05:05 pm »
I'm doing some maintenance on the stuff I use to work out and display version numbers, hence am revisiting the code we were discussing a couple of months ago to find out the actual widget set version at runtime.

Aha! I was making the mistake of looking for it in Lazarus, forgetting the underlying files in FPC :-)

Code: Pascal  [Select][+][-]
  1. uses
  2.   gtk2, BaseUnix;
  3.  
  4. type
  5.   guint= cuint;
  6.  
  7. var
  8.   gtk_major_version : guint;cvar;external;
  9.   gtk_minor_version : guint;cvar;external;
  10.   gtk_micro_version : guint;cvar;external;
  11.  
  12. begin
  13.   WriteLn('GTK ', gtk_major_version, '.', gtk_minor_version, '.', gtk_micro_version, '.')
  14. end.
  15.  

So it there an equivalent to this for GTK3? Looking at the FPC sources I can't see a gtk3 package, and while I can compile the program I'm using to experiment for GTK3 I don't see a directly-equivalent interface structure.

MarkMLl

I found constants in:

https://gitlab.com/freepascal.org/lazarus/lazarus/-/blob/main/lcl/interfaces/gtk3/gtk3bindings/lazgtk3.pas

GTK_MAJOR_VERSION
GTK_MINOR_VERSION
GTK_MICRO_VERSION

I that what you're looking for?
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

MarkMLl

  • Hero Member
  • *****
  • Posts: 8413
Re: Getting widgetset version
« Reply #21 on: December 10, 2022, 05:18:18 pm »
No, because those constants were generated on the FPC or Lazarus developer's machine. I need runtime info, since as discussed earlier in the thread I've got binaries which behave differently on different target systems depending on precisely what version of the GTK libraries are installed.

Over the last few minutes I've managed to get functions from lazgtk3 but that's necessitated an extremely unpleasant source path like  $(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/gtk3bindings  in the project options file.

Slightly later: I think I can usefully copy the declarations out of the LCL source tree and rely on the fact that the IDE's linkage of the required low-level libraries will set up paths etc. as required. Hence

Code: Pascal  [Select][+][-]
  1. var
  2. {$ifdef LCLGTK2 }
  3.         ws_major_version: cuint; external gtklib name 'gtk_major_version';
  4.         ws_minor_version: cuint; external gtklib name 'gtk_minor_version';
  5.         ws_micro_version: cuint; external gtklib name 'gtk_micro_version';
  6. {$endif LCLGTK2 }
  7. {$ifdef LCLGTK3 }
  8.         ws_major_version: cuint;
  9.         ws_minor_version: cuint;
  10.         ws_micro_version: cuint;
  11.  
  12. function gtk_get_major_version: cuint; cdecl; external;
  13. function gtk_get_micro_version: cuint; cdecl; external;
  14. function gtk_get_minor_version: cuint; cdecl; external;
  15. {$endif LCLGTK3 }
  16.  

and so on.

MarkMLl
« Last Edit: December 10, 2022, 05:35:19 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 8413
Re: Getting widgetset version
« Reply #22 on: December 15, 2022, 05:20:36 pm »
For completeness. I've currently got a legacy laptop running which has versions of Lazarus etc. which are sufficiently old that they handle GTK1 (nee unqualified GTK). Using this as well as newer systems, I can get a version triple for GTK1,2,3 as well as Qt and Qt5 using these snippets:

Code: Pascal  [Select][+][-]
  1. uses ...
  2.         {$ifdef UNIX}
  3.                 {$ifdef LCLGTK } , gtk {$endif LCLGTK1 }
  4.                 {$ifdef LCLGTK2 } , gtk2 {$endif LCLGTK2 }
  5.                 {$ifdef LCLQTX } , qtint {$endif LCLQTX }
  6.         {$endif UNIX } ;
  7. ...
  8. (* Depending on the widget set, the version information might be constants or   *)
  9. (* variables and while in some cases it might be possible to initialise them    *)
  10. (* here in others they have to be fetched after the underlying libraries have   *)
  11. (* been fully initialised.                                                      *)
  12.  
  13. {$ifdef LCLGTK2 }
  14. VAR     ws_major_version: cuint; external gtklib name 'gtk_major_version';
  15.         ws_minor_version: cuint; external gtklib name 'gtk_minor_version';
  16.         ws_micro_version: cuint; external gtklib name 'gtk_micro_version';
  17. {$else          }
  18. VAR     ws_major_version: cuint= 0;
  19.         ws_minor_version: cuint= 0;
  20.         ws_micro_version: cuint= 0;
  21. {$endif LCLGTK2 }
  22.  
  23. {$ifdef LCLGTK3 }
  24. function gtk_get_major_version: cuint; cdecl; external;
  25. function gtk_get_micro_version: cuint; cdecl; external;
  26. function gtk_get_minor_version: cuint; cdecl; external;
  27. {$endif LCLGTK3 }
  28. ...
  29.   (*$IFDEF LCLGTK *)
  30.     ws_major_version := gtk_major_version;
  31.     ws_minor_version := gtk_minor_version;
  32.     ws_micro_version := gtk_micro_version;
  33.   (*$ENDIF LCLGTK *)
  34.   (*$IFDEF LCLGTK3 *)
  35.     ws_major_version := gtk_get_major_version();
  36.     ws_minor_version := gtk_get_minor_version();
  37.     ws_micro_version := gtk_get_micro_version();
  38.   (*$ENDIF LCLGTK3 *)
  39.   {$ifdef LCLQTX }
  40.     ws_major_version := QtVersionMajor;
  41.     ws_minor_version := QtVersionMinor;
  42.     ws_micro_version := QtVersionMicro;
  43.   {$endif LCLQTX }
  44. ...
  45.  

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018