Forum > Linux

[ANSWERED]Detect GTK; QT, etc.

(1/4) > >>

CM630:
Does it make sense, and is it useful to detect if the app runs on GTK (2;3;4) or KDE or maybe some other GUI kit?
For example, it occurs that the TSaveDialogue in Mint Cinnamon works differently in Windows and MacOS, so it needs some additional handling. But maybe if I run the app on a QT Linux it will not work as expected?

dbannon:
Do you mean like this -


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---        Stg := rsAbout + #10 + rsAboutVer + ' ' + Version_String;                    // version is in cli unit.        {$ifdef LCLCOCOA} Stg := Stg + ', 64bit Cocoa'; {$endif}        {$ifdef LCLQT5}   Stg := Stg + ', QT5';         {$endif}        {$ifdef LCLQT6}   Stg := Stg + ', QT6';         {$endif}        {$ifdef LCLGTK3}  Stg := Stg + ', GTK3';        {$endif}        {$ifdef LCLGTK2}  Stg := Stg + ', GTK2';        {$endif}
Davo

CM630:
It seems I have never needed the answer before, but is the code in  {$ifdef xxxx}  yyyyy;        {$endif} included in the compiled binaries?
If I build the app in GTK2, is there a chance that it will always show "GTK2"?

dbannon:
If you build in the conventional way, using Lazarus, yes. I guess it might be possible to make a build environment that does not define , eg LCLGTK2 but it would be hard work. And very silly.

Davo

CM630:
If I have some uncompilable code in the {$ifdef} section for a different OS, the app is compiled.
So this is not what I am looking for; I need to detect the GUI kit during runtime.

Navigation

[0] Message Index

[#] Next page

Go to full version