GTK1 Interface: what changed
Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | *(GTK+ only)* | |
| 2 | 2 | ||
| 3 | 3 | > **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. | |
| 4 | 4 | ||
| 5 | 5 | ## Introduction | |
| 6 | 6 | ||
| 7 | 7 | The gtk1 widgetset is quite stable. There are still some bugs and missing properties. | |
| 8 | 8 | ||
| 9 | 9 | The documentation can be found [here](http://www.gtk.org/). | |
| 10 | 10 | ||
| 11 | 11 | The minimum Gtk 1 version supported is Gtk 1.2.18 | |
| 12 | 12 | ||
| 13 | 13 | ## Using the Gtk1 interface under macOS | |
| 14 | 14 | ||
| 15 | 15 | If you want to build gtk1 applications on macOS you need X11 and GTK 1.2 too: | |
| 16 | 16 | ||
| 17 | 17 | Apple X11: On a new system: choose "Customize" in the install dialog, check "X11". | |
| 18 | 18 | ||
| 19 | 19 | On an already installed system: | |
| 20 | 20 | ||
| 21 | 21 | MacOSX 10.3: download at: | |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 24 | <http://www.apple.com/downloads/macosx/apple/x11formacosx.html> | |
| 25 | 25 | ||
| 26 | 26 | MacOSX 10.4: install X11 from the DVD. | |
| 27 | 27 | ||
| 28 | 28 | 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: | |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | 31 | Download fink from <http://fink.sourceforge.net/download/index.php?phpLang=en>; follow the install instructions. | |
| 32 | 32 | ||
| 33 | 33 | In the Terminal, run | |
| 34 | 34 | ||
| 35 | - | ||
| 35 | + | ```text | |
| 36 | + | sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines | |
| 37 | + | ``` | |
| 36 | 38 | ||
| 37 | 39 | 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. | |
| 38 | 40 | ||
| 39 | 41 | 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: | |
| 40 | 42 | ||
| 41 | - | ||
| 43 | + | ```text | |
| 44 | + | defaults write com.apple.x11 wm_click_through -bool true | |
| 45 | + | ``` | |
| 42 | 46 | ||
| 43 | 47 | When compiling GTK-related software, you need to add two lines to the fpc.cfg file, to enable use of libraries: | |
| 44 | 48 | ||
| 45 | - | ||
| 46 | - | ||
| 49 | + | ```text | |
| 50 | + | -Fl/sw/lib | |
| 51 | + | -Fl/usr/X11R6/lib | |
| 52 | + | ``` | |
| 47 | 53 | ||
| 48 | 54 | ### Required software | |
| 49 | 55 | ||
| 50 | 56 | - Install Apple´s X11, available on your Installation Disk. | |
| 51 | 57 | ||
| 52 | 58 | For **Jaguar 10.2.x** you can download X11 on source forge at the [X11 on Mac](http://sourceforge.net/projects/xonx) Project. | |
| 53 | 59 | ||
| 54 | 60 | For **Panther 10.3.x** (but not for any other version!) also at [Apple](http://www.apple.com/downloads/macosx/apple/x11formacosx.html). | |
| 55 | 61 | ||
| 56 | 62 | 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. | |
| 57 | 63 | ||
| 58 | 64 | - Install Apple´s XCode, available on your Mac Installation Disk or at [Apple Developer Connection](http://connect.apple.com/) (requires creation of account, but the free online program is enough). This installs the XCode IDE and all the developer stuff. | |
| 59 | 65 | - Install fink, available at [Sourceforge](http://fink.sourceforge.net/). This is a Mac 'apt-get'esque package system. | |
| 60 | 66 | - Check if installation was successful, open a Terminal and type: | |
| 61 | 67 | ||
| 62 | - | ||
| 68 | + | ```text | |
| 69 | + | echo $PATH | |
| 70 | + | ``` | |
| 63 | 71 | ||
| 64 | 72 | This should give you: | |
| 65 | 73 | ||
| 66 | - | ||
| 74 | + | ```text | |
| 75 | + | /sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin | |
| 76 | + | ``` | |
| 67 | 77 | ||
| 68 | 78 | - After successfull installation of the above, open a Terminal and type: | |
| 69 | 79 | ||
| 70 | 80 | sudo apt-get update | |
| 71 | 81 | sudo apt-get install glib glib-shlibs gtk+-shlibs gdk-pixbuf gdk-pixbuf-shlibs | |
| 72 | 82 | ||
| 73 | 83 | This installs GTK. | |
| 74 | 84 | ||
| 75 | 85 | - Install [fpc and Lazarus](http://sourceforge.net/project/showfiles.php?group_id=89339) as .dmg for Mac. Now your´re ready to run. | |
| 76 | 86 | ||
| 77 | 87 | ====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](http://www.macports.org/), the command below should do the trick: | |
| 78 | 88 | ||
| 79 | - | ||
| 89 | + | ```text | |
| 90 | + | export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib:$DYLD_FALLBACK_LIBRARY_PATH" | |
| 91 | + | ``` | |
| 80 | 92 | ||
| 81 | 93 | The environment variable should be setup every time before running lazarus, or should be run from shell startup script. | |
| 82 | 94 | ||
| 83 | 95 | ### How to get going | |
| 84 | 96 | ||
| 85 | 97 | - Start X11. | |
| 86 | 98 | - You get your XTerm. Focus it and type | |
| 87 | 99 | ||
| 88 | 100 | cd /usr/local/share/lazarus/ | |
| 89 | 101 | ./lazarus | |
| 90 | 102 | ||
| 91 | 103 | ### Lazarus as Icon | |
| 92 | 104 | ||
| 93 | 105 | You can drag and drop the X11 app onto your dock to have a one-click way of starting X11. | |
| 94 | 106 | ||
| 95 | 107 | To simplify starting Lazarus, in X11, choose Applications \| Customize Menu, then click Add. Under Menu Name enter Lazarus, under Command enter the following: | |
| 96 | 108 | ||
| 97 | - | ||
| 109 | + | ```text | |
| 110 | + | /usr/local/share/lazarus/lazarus | |
| 111 | + | ``` | |
| 98 | 112 | ||
| 99 | 113 | Click Done to close. Now you can start Lazarus from X11 simply by choosing Applications \| Lazarus. | |
| 100 | 114 | ||
| 101 | 115 | BEWARE: if you use the below svn, then use | |
| 102 | 116 | ||
| 103 | - | ||
| 117 | + | ```text | |
| 118 | + | open -a /Users/yourname/pascal/lazarus/lazarus | |
| 119 | + | ``` | |
| 104 | 120 | ||
| 105 | 121 | --- | |
| 106 | 122 | *From the Free Pascal wiki, page "GTK1 Interface", as it stood on 2019-12-22 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 107 | 123 | Category: GTK Widgetsets | |
| 108 | 124 | Category: Lazarus | |
| 109 | 125 | Category: macOS |
