Difference between revisions of "GTK1 Interface"

From Lazarus wiki
Jump to navigationJump to search
(→‎Introduction: Added warning about gtk1 development stopping)
m (OSX -> macOS/dropped)
 
(9 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{GTK1 Interface}}
+
{{Platform only|GTK+|GTK Widgetsets|GTK+ Widgetsets}}
 +
<!--- {{GTK1 Interface}} --->
  
'''Gtk 1 development has been discontinued.''' The [[GTK2_Interface]] is now the default interface for *nix.  Patches however are still accepted to fix compilation when it breaks. There are no core Lazarus developers that still use the gtk1 interface. The information below may be outdated.
+
{{Warning|Gtk 1 development has been discontinued. The [[GTK2 Interface]] is now the default interface for *nix.  Patches however are still accepted to fix compilation when Gtk1 breaks. There are no core Lazarus developers that still use the gtk1 interface. The information below may be outdated.}}
  
 
==Introduction==
 
==Introduction==
Line 13: Line 14:
 
{{Other Interfaces}}
 
{{Other Interfaces}}
  
== Using the Gtk1 interface under Mac OS X ==
+
== Using the Gtk1 interface under macOS ==
  
If you want to build gtk1 applications on Mac OS X you need X11 and GTK 1.2 too:
+
If you want to build gtk1 applications on macOS you need X11 and GTK 1.2 too:
  
 
Apple X11: On a new system: choose "Customize" in the install dialog, check "X11".
 
Apple X11: On a new system: choose "Customize" in the install dialog, check "X11".
Line 32: Line 33:
 
         sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines
 
         sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines
  
The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click. X11 on Mac OS X 10.5 (Leopard) is different and starting X11.app is not recommended.
+
The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click. X11 on Leopard (10.5) is different and starting X11.app is not recommended.
  
Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under Mac OS X this is deactivated. You can activate it for all X11 applications by typing in the terminal:
+
Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under macOS this is deactivated. You can activate it for all X11 applications by typing in the terminal:
 
         defaults write com.apple.x11 wm_click_through -bool true
 
         defaults write com.apple.x11 wm_click_through -bool true
  
Line 43: Line 44:
 
=== Required software ===
 
=== Required software ===
  
*Install Apple´s X11, available on your Mac OS X Installation Disk.  
+
*Install Apple´s X11, available on your Installation Disk.  
  
For '''Mac OS X 10.2.x''' you can download X11 on source forge at the [http://sourceforge.net/projects/xonx X11 on Mac OS X] Project.
+
For '''Jaguar 10.2.x''' you can download X11 on source forge at the [http://sourceforge.net/projects/xonx X11 on Mac] Project.
  
For '''Mac OS X 10.3.x''' (but not for any other Mac OS X version!) also at [http://www.apple.com/downloads/macosx/apple/x11formacosx.html Apple].
+
For '''Panther 10.3.x''' (but not for any other version!) also at [http://www.apple.com/downloads/macosx/apple/x11formacosx.html Apple].
  
For '''Mac OS X 10.4 Tiger''' you must install X11 from your tiger DVD. This is for OS X to be able to display X11 programs. Tip: Drag the X11-Icon from /Applications/Utilities/X11 into the Dock for convenient starting.
+
For '''Tiger 10.4''' you must install X11 from your tiger DVD. This is to be able to display X11 programs. Tip: Drag the X11-Icon from /Applications/Utilities/X11 into the Dock for convenient starting.
*Install Apple´s XCode, available on your Mac OS X Installation Disk or at [http://connect.apple.com/ Apple Developer Connection] (requires creation of account, but the free online program is enough). This installs the XCode IDE and all the developer stuff.
+
*Install Apple´s XCode, available on your Mac Installation Disk or at [http://connect.apple.com/ Apple Developer Connection] (requires creation of account, but the free online program is enough). This installs the XCode IDE and all the developer stuff.
*Install fink, available at [http://fink.sourceforge.net/ Sourceforge]. This is an OS X 'apt-get'esque package system.
+
*Install fink, available at [http://fink.sourceforge.net/ Sourceforge]. This is a Mac 'apt-get'esque package system.
 
*Check if installation was successful, open a Terminal and type:
 
*Check if installation was successful, open a Terminal and type:
 
   echo $PATH
 
   echo $PATH
Line 67: Line 68:
 
This installs GTK.
 
This installs GTK.
  
*Install [http://sourceforge.net/project/showfiles.php?group_id=89339 fpc and Lazarus] as .dmg for Mac OS X. Now your´re ready to run.
+
*Install [http://sourceforge.net/project/showfiles.php?group_id=89339 fpc and Lazarus] as .dmg for Mac. Now your´re ready to run.
  
 
<br />
 
<br />
{| border="1" cellpadding="2" cellspacing="0"
+
====If you decide not to use Fink or if your Fink installation is customized====
|-
 
! If you decide not to use Fink or if your Fink installation is customized
 
|- valign="top"
 
|
 
 
If you install <tt>gdk-pixbuf</tt>, <tt>gtk</tt>, and <tt>glib</tt> libraries not using Fink, or if your Fink installation is customized to install under other than <tt>/sw</tt> directory, then make sure that the environment variable <tt>DYLD_LIBRARY_PATH</tt> point to where the libraries are. For instance, it you use [http://www.macports.org/ MacPorts], the command below should do the trick:
 
If you install <tt>gdk-pixbuf</tt>, <tt>gtk</tt>, and <tt>glib</tt> libraries not using Fink, or if your Fink installation is customized to install under other than <tt>/sw</tt> directory, then make sure that the environment variable <tt>DYLD_LIBRARY_PATH</tt> point to where the libraries are. For instance, it you use [http://www.macports.org/ MacPorts], the command below should do the trick:
  
Line 80: Line 77:
  
 
The environment variable should be setup every time before running lazarus, or should be run from shell startup script.
 
The environment variable should be setup every time before running lazarus, or should be run from shell startup script.
|}
 
  
 
=== How to get going ===
 
=== How to get going ===
Line 102: Line 98:
 
BEWARE: if you use the below svn, then use
 
BEWARE: if you use the below svn, then use
 
   open -a /Users/yourname/pascal/lazarus/lazarus
 
   open -a /Users/yourname/pascal/lazarus/lazarus
 +
 +
[[Category:macOS]]
 +
[[Category:Lazarus]]
 +
[[Category:GTK Widgetsets]]

Latest revision as of 03:54, 22 December 2019

GTK logo.svg

This article applies to GTK+ Widgetsets only.

See also: Multiplatform Programming Guide

Warning-icon.png

Warning: Gtk 1 development has been discontinued. The GTK2 Interface is now the default interface for *nix. Patches however are still accepted to fix compilation when Gtk1 breaks. There are no core Lazarus developers that still use the gtk1 interface. The information below may be outdated.

Introduction

The gtk1 widgetset is quite stable. There are still some bugs and missing properties.

The documentation can be found here.

The minimum Gtk 1 version supported is Gtk 1.2.18

Other Interfaces

Platform specific Tips

Interface Development Articles

Using the Gtk1 interface under macOS

If you want to build gtk1 applications on macOS you need X11 and GTK 1.2 too:

Apple X11: On a new system: choose "Customize" in the install dialog, check "X11".

On an already installed system:

MacOSX 10.3: download at:

http://www.apple.com/downloads/macosx/apple/x11formacosx.html

MacOSX 10.4: install X11 from the DVD.

GTK 1.2: Downloading the GTK packages and installing them properly can be a time consuming task. Therefore there are various package managers. One of them is fink:

Download fink from http://fink.sourceforge.net/download/index.php?phpLang=en; follow the install instructions.

In the Terminal, run

       sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines

The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click. X11 on Leopard (10.5) is different and starting X11.app is not recommended.

Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under macOS this is deactivated. You can activate it for all X11 applications by typing in the terminal:

       defaults write com.apple.x11 wm_click_through -bool true

When compiling GTK-related software, you need to add two lines to the fpc.cfg file, to enable use of libraries:

-Fl/sw/lib
-Fl/usr/X11R6/lib

Required software

  • Install Apple´s X11, available on your Installation Disk.

For Jaguar 10.2.x you can download X11 on source forge at the X11 on Mac Project.

For Panther 10.3.x (but not for any other version!) also at Apple.

For Tiger 10.4 you must install X11 from your tiger DVD. This is to be able to display X11 programs. Tip: Drag the X11-Icon from /Applications/Utilities/X11 into the Dock for convenient starting.

  • Install Apple´s XCode, available on your Mac Installation Disk or at Apple Developer Connection (requires creation of account, but the free online program is enough). This installs the XCode IDE and all the developer stuff.
  • Install fink, available at Sourceforge. This is a Mac 'apt-get'esque package system.
  • Check if installation was successful, open a Terminal and type:
 echo $PATH

This should give you:

 /sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin

  • After successfull installation of the above, open a Terminal and type:
sudo apt-get update
sudo apt-get install glib glib-shlibs gtk+-shlibs gdk-pixbuf gdk-pixbuf-shlibs


This installs GTK.


If you decide not to use Fink or if your Fink installation is customized

If you install gdk-pixbuf, gtk, and glib libraries not using Fink, or if your Fink installation is customized to install under other than /sw directory, then make sure that the environment variable DYLD_LIBRARY_PATH point to where the libraries are. For instance, it you use MacPorts, the command below should do the trick:

export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib:$DYLD_FALLBACK_LIBRARY_PATH"

The environment variable should be setup every time before running lazarus, or should be run from shell startup script.

How to get going

  • Start X11.
  • You get your XTerm. Focus it and type
cd /usr/local/share/lazarus/
./lazarus

Lazarus as Icon

You can drag and drop the X11 app onto your dock to have a one-click way of starting X11.

To simplify starting Lazarus, in X11, choose Applications | Customize Menu, then click Add. Under Menu Name enter Lazarus, under Command enter the following:

/usr/local/share/lazarus/lazarus

Click Done to close. Now you can start Lazarus from X11 simply by choosing Applications | Lazarus.

BEWARE: if you use the below svn, then use

 open -a /Users/yourname/pascal/lazarus/lazarus