Merge lp:~inkscape.dev/inkscape/osx-packaging-update into lp:~inkscape.dev/inkscape/trunk
- osx-packaging-update
- Merge into trunk
Status: | Needs review | ||||||||
---|---|---|---|---|---|---|---|---|---|
Proposed branch: | lp:~inkscape.dev/inkscape/osx-packaging-update | ||||||||
Merge into: | lp:~inkscape.dev/inkscape/trunk | ||||||||
Diff against target: |
531 lines (+157/-147) 10 files modified
packaging/macosx/Resources/bin/inkscape (+8/-18) packaging/macosx/Resources/openDoc (+4/-0) packaging/macosx/Resources/script (+5/-6) packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh (+10/-19) packaging/macosx/ScriptExec/main.c (+7/-86) src/extension/internal/pdfinput/pdf-input.cpp (+6/-1) src/path-prefix.h (+17/-17) src/prefix.cpp (+75/-0) src/prefix.h (+17/-0) src/ui/dialog/inkscape-preferences.cpp (+8/-0) |
||||||||
To merge this branch: | bzr merge lp:~inkscape.dev/inkscape/osx-packaging-update | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Inkscape Developers | Pending | ||
Review via email: mp+278139@code.launchpad.net |
Commit message
Description of the change
Rewrite of relocation support for OS X application bundles:
Instead of requiring CWD to be a specific location inside the app bundle (to resolve relative paths to Inkscape's shared resources), use a macro similar to relocation support for Linux and Windows, based on the path of the current executable. This will ease command line usage (bug #181639).
su_v (suv-lp) wrote : | # |
The proposed changes in src/ are still useful (the merge proposal was never closed): future packages for macOS with GTK3/Quartz will still benefit if Inkscape had better internal relocation support on that platform than what the current code offers. The details of the proposed changes will have to be reviewed/adapted by whoever will work on future macOS packages of Inkscape with GTK3/Quartz.
Proposing to keep this one open for now.
Unmerged revisions
- 14484. By su_v
-
packaging/macosx: update comments in launcher scripts about CWD and relocation support
- 14483. By su_v
-
packaging/macosx: sync quartz launcher script (currently not used)
- 14482. By su_v
-
packaging/macosx: use new path-prefix macro for poppler relocation support
- 14481. By su_v
-
packaging/macosx: no need to store bundleId for relocation support with gtk-mac-integration
- 14480. By su_v
-
packaging/macosx: rewrite relocation support (bug #181639)
- 14479. By su_v
-
packaging/macosx: ScriptExec - remove unused code
Preview Diff
1 | === modified file 'packaging/macosx/Resources/bin/inkscape' | |||
2 | --- packaging/macosx/Resources/bin/inkscape 2015-11-02 10:14:45 +0000 | |||
3 | +++ packaging/macosx/Resources/bin/inkscape 2015-11-20 12:21:31 +0000 | |||
4 | @@ -23,17 +23,6 @@ | |||
5 | 23 | BASE="$(echo "$TOP" | sed -e 's/\/Contents\/Resources.*$//')" | 23 | BASE="$(echo "$TOP" | sed -e 's/\/Contents\/Resources.*$//')" |
6 | 24 | # e.g. /Applications/Inkscape.app | 24 | # e.g. /Applications/Inkscape.app |
7 | 25 | 25 | ||
8 | 26 | # FIXME: Inkscape needs better relocation support for OS X (get rid of the relative | ||
9 | 27 | # path hack in src/path-prefix.h for osxapp-enabled builds). Until then, below change | ||
10 | 28 | # of working directory is required: | ||
11 | 29 | # | ||
12 | 30 | # Due to changes after 0.48, we have to change working directory in the script named 'inkscape': | ||
13 | 31 | # recursive calls to inkscape from python-based extensions otherwise cause the app to hang or | ||
14 | 32 | # fail (for python-based extensions, inkscape changes the working directory to the | ||
15 | 33 | # script's directory, and inkscape launched by python script thus can't find resources | ||
16 | 34 | # like the now essential 'units.xml' in INKSCAPE_UIDIR relative to the working directory). | ||
17 | 35 | cd "$BASE" || exit 1 | ||
18 | 36 | |||
19 | 37 | # don't prepend to $PATH in recursive calls: | 26 | # don't prepend to $PATH in recursive calls: |
20 | 38 | if [ -z "$INK_PATH_ORIG" ]; then | 27 | if [ -z "$INK_PATH_ORIG" ]; then |
21 | 39 | 28 | ||
22 | @@ -43,6 +32,7 @@ | |||
23 | 43 | # Fink | 32 | # Fink |
24 | 44 | # MacPorts (former DarwinPorts) | 33 | # MacPorts (former DarwinPorts) |
25 | 45 | # LaTeX distribution for Mac OS X | 34 | # LaTeX distribution for Mac OS X |
26 | 35 | # LaTeX distribution for OS X El Capitan | ||
27 | 46 | PATH_OTHER="/Library/TeX/texbin:/usr/texbin:/opt/local/bin:/sw/bin/:/usr/local/bin" | 36 | PATH_OTHER="/Library/TeX/texbin:/usr/texbin:/opt/local/bin:/sw/bin/:/usr/local/bin" |
28 | 47 | 37 | ||
29 | 48 | # Put /usr/bin at beginning of path so we make sure we use Apple's python | 38 | # Put /usr/bin at beginning of path so we make sure we use Apple's python |
30 | @@ -93,7 +83,6 @@ | |||
31 | 93 | export GVFS_DISABLE_FUSE=1 | 83 | export GVFS_DISABLE_FUSE=1 |
32 | 94 | export XDG_DATA_DIRS="$TOP/share" | 84 | export XDG_DATA_DIRS="$TOP/share" |
33 | 95 | export ASPELL_CONF="prefix $TOP;" | 85 | export ASPELL_CONF="prefix $TOP;" |
34 | 96 | export POPPLER_DATADIR="$TOP/share/poppler" | ||
35 | 97 | 86 | ||
36 | 98 | # no DBUS for now | 87 | # no DBUS for now |
37 | 99 | unset DBUS_LAUNCHD_SESSION_BUS_SOCKET | 88 | unset DBUS_LAUNCHD_SESSION_BUS_SOCKET |
38 | @@ -109,16 +98,14 @@ | |||
39 | 109 | export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" | 98 | export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" |
40 | 110 | export INKSCAPE_LOCALEDIR="$TOP/share/locale" | 99 | export INKSCAPE_LOCALEDIR="$TOP/share/locale" |
41 | 111 | 100 | ||
42 | 112 | # Handle the case where the directory storing Inkscape has special characters | ||
43 | 113 | # ('#', '&', '|') in the name. These need to be escaped to work properly for | ||
44 | 114 | # various configuration files. | ||
45 | 115 | ESCAPEDTOP=`echo "$TOP" | sed 's/#/\\\\\\\\#/' | sed 's/&/\\\\\\&/g' | sed 's/|/\\\\\\|/g'` | ||
46 | 116 | |||
47 | 117 | # Set GTK theme (only if there is no .gtkrc-2.0 in the user's home) | 101 | # Set GTK theme (only if there is no .gtkrc-2.0 in the user's home) |
48 | 118 | if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then | 102 | if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then |
50 | 119 | export GTK2_RC_FILES="$ESCAPEDTOP/etc/gtk-2.0/gtkrc" | 103 | export GTK2_RC_FILES="$TOP/etc/gtk-2.0/gtkrc" |
51 | 120 | fi | 104 | fi |
52 | 121 | 105 | ||
53 | 106 | # ---------------------------- | ||
54 | 107 | # FIXME language detection and conversion into supported locale | ||
55 | 108 | |||
56 | 122 | # If the AppleCollationOrder preference doesn't exist, we fall back to using | 109 | # If the AppleCollationOrder preference doesn't exist, we fall back to using |
57 | 123 | # the AppleLocale preference. | 110 | # the AppleLocale preference. |
58 | 124 | LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null` | 111 | LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null` |
59 | @@ -154,6 +141,9 @@ | |||
60 | 154 | [ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 | 141 | [ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 |
61 | 155 | export LC_ALL="$LANG" | 142 | export LC_ALL="$LANG" |
62 | 156 | 143 | ||
63 | 144 | # end FIXME language detection | ||
64 | 145 | # ---------------------------- | ||
65 | 146 | |||
66 | 157 | case "$INK_DEBUG" in | 147 | case "$INK_DEBUG" in |
67 | 158 | gdb) | 148 | gdb) |
68 | 159 | EXEC="gdb --args" ;; | 149 | EXEC="gdb --args" ;; |
69 | 160 | 150 | ||
70 | === modified file 'packaging/macosx/Resources/openDoc' | |||
71 | --- packaging/macosx/Resources/openDoc 2014-10-24 05:01:09 +0000 | |||
72 | +++ packaging/macosx/Resources/openDoc 2015-11-20 12:21:31 +0000 | |||
73 | @@ -14,4 +14,8 @@ | |||
74 | 14 | 14 | ||
75 | 15 | source "${CWD}/xdg_setup.sh" | 15 | source "${CWD}/xdg_setup.sh" |
76 | 16 | 16 | ||
77 | 17 | # When launched via Finder, cd into $HOME first (otherwise CWD in | ||
78 | 18 | # GtkFileChooser's Places is '/'). | ||
79 | 19 | cd "$HOME" | ||
80 | 20 | |||
81 | 17 | exec "$CWD/bin/inkscape" "$@" | 21 | exec "$CWD/bin/inkscape" "$@" |
82 | 18 | 22 | ||
83 | === modified file 'packaging/macosx/Resources/script' | |||
84 | --- packaging/macosx/Resources/script 2014-10-24 05:01:09 +0000 | |||
85 | +++ packaging/macosx/Resources/script 2015-11-20 12:21:31 +0000 | |||
86 | @@ -17,11 +17,10 @@ | |||
87 | 17 | source "${CWD}/xdg_setup.sh" | 17 | source "${CWD}/xdg_setup.sh" |
88 | 18 | source "${CWD}/alert_fccache.sh" | 18 | source "${CWD}/alert_fccache.sh" |
89 | 19 | 19 | ||
96 | 20 | # TODO examine whether it would be wisest to move the code from inkscape shell | 20 | # When launched via Finder, cd into $HOME first (otherwise CWD in |
97 | 21 | # script and getdisplay.sh to here and only keep the real binary in bin. This | 21 | # GtkFileChooser's Places is '/'). Direct command line usage of |
98 | 22 | # may make things easier on Leopard and may also help using Inkscape on the | 22 | # Inkscape.app/Contents/Resources/bin/inkscape is now possible |
99 | 23 | # command line. | 23 | # without requiring absolute paths (better relocation support). |
100 | 24 | # | 24 | cd "$HOME" |
95 | 25 | # See related FIXME in bin/inkscape for requirements to merge the two scripts. | ||
101 | 26 | 25 | ||
102 | 27 | exec "$CWD/bin/inkscape" "$@" | 26 | exec "$CWD/bin/inkscape" "$@" |
103 | 28 | 27 | ||
104 | === modified file 'packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh' | |||
105 | --- packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh 2015-01-10 16:06:20 +0000 | |||
106 | +++ packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh 2015-11-20 12:21:31 +0000 | |||
107 | @@ -26,17 +26,6 @@ | |||
108 | 26 | source "${TOP}/xdg_setup.sh" | 26 | source "${TOP}/xdg_setup.sh" |
109 | 27 | source "${TOP}/alert_fccache.sh" | 27 | source "${TOP}/alert_fccache.sh" |
110 | 28 | 28 | ||
111 | 29 | # FIXME: Inkscape needs better relocation support for OS X (get rid of the relative | ||
112 | 30 | # path hack in src/path-prefix.h for osxapp-enabled builds). Until then, below change | ||
113 | 31 | # of working directory is required: | ||
114 | 32 | # | ||
115 | 33 | # Due to changes after 0.48, we have to change working directory in the script named 'inkscape': | ||
116 | 34 | # recursive calls to inkscape from python-based extensions otherwise cause the app to hang or | ||
117 | 35 | # fail (for python-based extensions, inkscape changes the working directory to the | ||
118 | 36 | # script's directory, and inkscape launched by python script thus can't find resources | ||
119 | 37 | # like the now essential 'units.xml' in INKSCAPE_UIDIR relative to the working directory). | ||
120 | 38 | cd "$BASE" || exit 1 | ||
121 | 39 | |||
122 | 40 | # don't prepend to $PATH in recursive calls: | 29 | # don't prepend to $PATH in recursive calls: |
123 | 41 | if [ -z "$INK_PATH_ORIG" ]; then | 30 | if [ -z "$INK_PATH_ORIG" ]; then |
124 | 42 | 31 | ||
125 | @@ -46,7 +35,8 @@ | |||
126 | 46 | # Fink | 35 | # Fink |
127 | 47 | # MacPorts (former DarwinPorts) | 36 | # MacPorts (former DarwinPorts) |
128 | 48 | # LaTeX distribution for Mac OS X | 37 | # LaTeX distribution for Mac OS X |
130 | 49 | PATH_OTHER="/usr/texbin:/opt/local/bin:/sw/bin/:/usr/local/bin" | 38 | # LaTeX distribution for OS X El Capitan |
131 | 39 | PATH_OTHER="/Library/TeX/texbin:/usr/texbin:/opt/local/bin:/sw/bin/:/usr/local/bin" | ||
132 | 50 | 40 | ||
133 | 51 | # Put /usr/bin at beginning of path so we make sure we use Apple's python | 41 | # Put /usr/bin at beginning of path so we make sure we use Apple's python |
134 | 52 | # over one that may be installed be Macports, Fink or some other means. | 42 | # over one that may be installed be Macports, Fink or some other means. |
135 | @@ -96,7 +86,6 @@ | |||
136 | 96 | export GVFS_DISABLE_FUSE=1 | 86 | export GVFS_DISABLE_FUSE=1 |
137 | 97 | export XDG_DATA_DIRS="$TOP/share" | 87 | export XDG_DATA_DIRS="$TOP/share" |
138 | 98 | export ASPELL_CONF="prefix $TOP;" | 88 | export ASPELL_CONF="prefix $TOP;" |
139 | 99 | export POPPLER_DATADIR="$TOP/share/poppler" | ||
140 | 100 | 89 | ||
141 | 101 | # no DBUS for now | 90 | # no DBUS for now |
142 | 102 | unset DBUS_LAUNCHD_SESSION_BUS_SOCKET | 91 | unset DBUS_LAUNCHD_SESSION_BUS_SOCKET |
143 | @@ -112,16 +101,14 @@ | |||
144 | 112 | export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" | 101 | export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" |
145 | 113 | export INKSCAPE_LOCALEDIR="$TOP/share/locale" | 102 | export INKSCAPE_LOCALEDIR="$TOP/share/locale" |
146 | 114 | 103 | ||
147 | 115 | # Handle the case where the directory storing Inkscape has special characters | ||
148 | 116 | # ('#', '&', '|') in the name. These need to be escaped to work properly for | ||
149 | 117 | # various configuration files. | ||
150 | 118 | ESCAPEDTOP=`echo "$TOP" | sed 's/#/\\\\\\\\#/' | sed 's/&/\\\\\\&/g' | sed 's/|/\\\\\\|/g'` | ||
151 | 119 | |||
152 | 120 | # Set GTK theme (only if there is no .gtkrc-2.0 in the user's home) | 104 | # Set GTK theme (only if there is no .gtkrc-2.0 in the user's home) |
153 | 121 | if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then | 105 | if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then |
155 | 122 | export GTK2_RC_FILES="$ESCAPEDTOP/etc/gtk-2.0/gtkrc" | 106 | export GTK2_RC_FILES="$TOP/etc/gtk-2.0/gtkrc" |
156 | 123 | fi | 107 | fi |
157 | 124 | 108 | ||
158 | 109 | # ---------------------------- | ||
159 | 110 | # FIXME language detection and conversion into supported locale | ||
160 | 111 | |||
161 | 125 | # If the AppleCollationOrder preference doesn't exist, we fall back to using | 112 | # If the AppleCollationOrder preference doesn't exist, we fall back to using |
162 | 126 | # the AppleLocale preference. | 113 | # the AppleLocale preference. |
163 | 127 | LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null` | 114 | LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null` |
164 | @@ -157,6 +144,9 @@ | |||
165 | 157 | [ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 | 144 | [ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 |
166 | 158 | export LC_ALL="$LANG" | 145 | export LC_ALL="$LANG" |
167 | 159 | 146 | ||
168 | 147 | # end FIXME language detection | ||
169 | 148 | # ---------------------------- | ||
170 | 149 | |||
171 | 160 | case "$INK_DEBUG" in | 150 | case "$INK_DEBUG" in |
172 | 161 | gdb) | 151 | gdb) |
173 | 162 | EXEC="gdb --args" ;; | 152 | EXEC="gdb --args" ;; |
174 | @@ -170,6 +160,7 @@ | |||
175 | 170 | unset INK_DEBUG # ignore for recursive calls | 160 | unset INK_DEBUG # ignore for recursive calls |
176 | 171 | 161 | ||
177 | 172 | if [ "x$INK_DEBUG_SHELL" != "x" ]; then | 162 | if [ "x$INK_DEBUG_SHELL" != "x" ]; then |
178 | 163 | unset INK_DEBUG_SHELL # ignore for recursive calls | ||
179 | 173 | exec bash | 164 | exec bash |
180 | 174 | else | 165 | else |
181 | 175 | $EXEC "$CWD/inkscape-bin" "$@" | 166 | $EXEC "$CWD/inkscape-bin" "$@" |
182 | 176 | 167 | ||
183 | === modified file 'packaging/macosx/ScriptExec/main.c' | |||
184 | --- packaging/macosx/ScriptExec/main.c 2014-08-21 10:26:09 +0000 | |||
185 | +++ packaging/macosx/ScriptExec/main.c 2015-11-20 12:21:31 +0000 | |||
186 | @@ -42,8 +42,7 @@ | |||
187 | 42 | // Apple stuff | 42 | // Apple stuff |
188 | 43 | 43 | ||
189 | 44 | // Note: including Carbon prevents building the launcher app in x86_64 | 44 | // Note: including Carbon prevents building the launcher app in x86_64 |
192 | 45 | // used for StandardAlert in RequestUserAttention(), | 45 | // used for StandardAlert in RedFatalAlert() |
191 | 46 | // RedFatalAlert() | ||
193 | 47 | #include <Carbon/Carbon.h> | 46 | #include <Carbon/Carbon.h> |
194 | 48 | 47 | ||
195 | 49 | #include <CoreFoundation/CoreFoundation.h> | 48 | #include <CoreFoundation/CoreFoundation.h> |
196 | @@ -103,8 +102,6 @@ | |||
197 | 103 | AppleEvent *reply, long refCon); | 102 | AppleEvent *reply, long refCon); |
198 | 104 | static OSErr AppOpenAppAEHandler(const AppleEvent *theAppleEvent, | 103 | static OSErr AppOpenAppAEHandler(const AppleEvent *theAppleEvent, |
199 | 105 | AppleEvent *reply, long refCon); | 104 | AppleEvent *reply, long refCon); |
200 | 106 | static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall, | ||
201 | 107 | EventRef theEvent, void *userData); | ||
202 | 108 | static OSErr AppReopenAppAEHandler(const AppleEvent *theAppleEvent, | 105 | static OSErr AppReopenAppAEHandler(const AppleEvent *theAppleEvent, |
203 | 109 | AppleEvent *reply, long refCon); | 106 | AppleEvent *reply, long refCon); |
204 | 110 | 107 | ||
205 | @@ -146,7 +143,6 @@ | |||
206 | 146 | int main(int argc, char* argv[]) | 143 | int main(int argc, char* argv[]) |
207 | 147 | { | 144 | { |
208 | 148 | OSErr err = noErr; | 145 | OSErr err = noErr; |
209 | 149 | EventTypeSpec FCCacheEvents = { kEventClassRedFatalAlert, kEventKindFCCacheFailed }; | ||
210 | 150 | 146 | ||
211 | 151 | InitCursor(); | 147 | InitCursor(); |
212 | 152 | 148 | ||
213 | @@ -165,16 +161,12 @@ | |||
214 | 165 | NewAEEventHandlerUPP(AppReopenAppAEHandler), | 161 | NewAEEventHandlerUPP(AppReopenAppAEHandler), |
215 | 166 | 0, false); | 162 | 0, false); |
216 | 167 | 163 | ||
217 | 168 | err += InstallEventHandler(GetApplicationEventTarget(), | ||
218 | 169 | NewEventHandlerUPP(FCCacheFailedHandler), 1, | ||
219 | 170 | &FCCacheEvents, NULL, NULL); | ||
220 | 171 | |||
221 | 172 | if (err) RedFatalAlert("\pInitialization Error", | 164 | if (err) RedFatalAlert("\pInitialization Error", |
222 | 173 | "\pError initing Apple Event handlers."); | 165 | "\pError initing Apple Event handlers."); |
223 | 174 | 166 | ||
224 | 175 | //create the menu bar | 167 | //create the menu bar |
227 | 176 | if (err = LoadMenuBar(NULL)) RedFatalAlert("\pInitialization Error", | 168 | if ((err = LoadMenuBar(NULL))) RedFatalAlert("\pInitialization Error", |
228 | 177 | "\pError loading MenuBar.nib."); | 169 | "\pError loading MenuBar.nib."); |
229 | 178 | 170 | ||
230 | 179 | GetParameters(); //load data from files containing exec settings | 171 | GetParameters(); //load data from files containing exec settings |
231 | 180 | 172 | ||
232 | @@ -188,86 +180,15 @@ | |||
233 | 188 | #pragma mark - | 180 | #pragma mark - |
234 | 189 | 181 | ||
235 | 190 | 182 | ||
236 | 191 | static void RequestUserAttention(void) | ||
237 | 192 | { | ||
238 | 193 | NMRecPtr notificationRequest = (NMRecPtr) NewPtr(sizeof(NMRec)); | ||
239 | 194 | |||
240 | 195 | memset(notificationRequest, 0, sizeof(*notificationRequest)); | ||
241 | 196 | notificationRequest->qType = nmType; | ||
242 | 197 | notificationRequest->nmMark = 1; | ||
243 | 198 | notificationRequest->nmIcon = 0; | ||
244 | 199 | notificationRequest->nmSound = 0; | ||
245 | 200 | notificationRequest->nmStr = NULL; | ||
246 | 201 | notificationRequest->nmResp = NULL; | ||
247 | 202 | |||
248 | 203 | verify_noerr(NMInstall(notificationRequest)); | ||
249 | 204 | } | ||
250 | 205 | |||
251 | 206 | |||
252 | 207 | static void ShowFirstStartWarningDialog(void) | ||
253 | 208 | { | ||
254 | 209 | SInt16 itemHit; | ||
255 | 210 | |||
256 | 211 | AlertStdAlertParamRec params; | ||
257 | 212 | params.movable = true; | ||
258 | 213 | params.helpButton = false; | ||
259 | 214 | params.filterProc = NULL; | ||
260 | 215 | params.defaultText = (void *) kAlertDefaultOKText; | ||
261 | 216 | params.cancelText = NULL; | ||
262 | 217 | params.otherText = NULL; | ||
263 | 218 | params.defaultButton = kAlertStdAlertOKButton; | ||
264 | 219 | params.cancelButton = kAlertStdAlertCancelButton; | ||
265 | 220 | params.position = kWindowDefaultPosition; | ||
266 | 221 | |||
267 | 222 | StandardAlert(kAlertNoteAlert, "\pInkscape on Mac OS X", | ||
268 | 223 | "\pWhile Inkscape is open, its windows can be displayed or hidden by displaying or hiding the X11 application.\n\nThe first time this version of Inkscape is run it may take several minutes before the main window is displayed while font caches are built.", | ||
269 | 224 | ¶ms, &itemHit); | ||
270 | 225 | } | ||
271 | 226 | |||
272 | 227 | |||
273 | 228 | ////////////////////////////////// | ||
274 | 229 | // Handler for when fontconfig caches need to be generated | ||
275 | 230 | // TODO: remove (alert and touch moved to launcher script) | ||
276 | 231 | ////////////////////////////////// | ||
277 | 232 | static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall, | ||
278 | 233 | EventRef theEvent, void *userData) | ||
279 | 234 | { | ||
280 | 235 | |||
281 | 236 | pthread_join(tid, NULL); | ||
282 | 237 | if (odtid) pthread_join(odtid, NULL); | ||
283 | 238 | |||
284 | 239 | // Bounce Inkscape Dock icon | ||
285 | 240 | RequestUserAttention(); | ||
286 | 241 | // Need to show warning to the user, then carry on. | ||
287 | 242 | ShowFirstStartWarningDialog(); | ||
288 | 243 | |||
289 | 244 | // Note that we've seen the warning. | ||
290 | 245 | system("test -d \"$HOME/.cache/inkscape\" || mkdir -p \"$HOME/.cache/inkscape\"; " | ||
291 | 246 | "touch \"$HOME/.cache/inkscape/.fccache-new\""); | ||
292 | 247 | // Rerun now. | ||
293 | 248 | OSErr err = ExecuteScript(scriptPath, &pid); | ||
294 | 249 | ExitToShell(); | ||
295 | 250 | |||
296 | 251 | return noErr; | ||
297 | 252 | } | ||
298 | 253 | |||
299 | 254 | |||
300 | 255 | /////////////////////////////////// | 183 | /////////////////////////////////// |
301 | 256 | // Execution thread starts here | 184 | // Execution thread starts here |
302 | 257 | /////////////////////////////////// | 185 | /////////////////////////////////// |
303 | 258 | static void *Execute (void *arg) | 186 | static void *Execute (void *arg) |
304 | 259 | { | 187 | { |
305 | 260 | EventRef event; | ||
306 | 261 | |||
307 | 262 | taskDone = false; | 188 | taskDone = false; |
308 | 263 | 189 | ||
316 | 264 | OSErr err = ExecuteScript(scriptPath, &pid); | 190 | ExecuteScript(scriptPath, &pid); |
317 | 265 | if (err == (OSErr)12) { | 191 | ExitToShell(); |
311 | 266 | CreateEvent(NULL, kEventClassRedFatalAlert, kEventKindFCCacheFailed, 0, | ||
312 | 267 | kEventAttributeNone, &event); | ||
313 | 268 | PostEventToQueue(GetMainEventQueue(), event, kEventPriorityHigh); | ||
314 | 269 | } | ||
315 | 270 | else ExitToShell(); | ||
318 | 271 | return 0; | 192 | return 0; |
319 | 272 | } | 193 | } |
320 | 273 | 194 | ||
321 | @@ -407,8 +328,8 @@ | |||
322 | 407 | OSErr err; | 328 | OSErr err; |
323 | 408 | IBNibRef nibRef; | 329 | IBNibRef nibRef; |
324 | 409 | 330 | ||
327 | 410 | if (err = CreateNibReference(CFSTR("MenuBar"), &nibRef)) return err; | 331 | if ((err = CreateNibReference(CFSTR("MenuBar"), &nibRef))) return err; |
328 | 411 | if (err = SetMenuBarFromNib(nibRef, CFSTR("MenuBar"))) return err; | 332 | if ((err = SetMenuBarFromNib(nibRef, CFSTR("MenuBar")))) return err; |
329 | 412 | DisposeNibReference(nibRef); | 333 | DisposeNibReference(nibRef); |
330 | 413 | 334 | ||
331 | 414 | return noErr; | 335 | return noErr; |
332 | 415 | 336 | ||
333 | === modified file 'src/extension/internal/pdfinput/pdf-input.cpp' | |||
334 | --- src/extension/internal/pdfinput/pdf-input.cpp 2015-10-19 16:01:08 +0000 | |||
335 | +++ src/extension/internal/pdfinput/pdf-input.cpp 2015-11-20 12:21:31 +0000 | |||
336 | @@ -62,6 +62,10 @@ | |||
337 | 62 | 62 | ||
338 | 63 | #include <gdkmm/general.h> | 63 | #include <gdkmm/general.h> |
339 | 64 | 64 | ||
340 | 65 | #ifdef ENABLE_OSX_APP_LOCATIONS | ||
341 | 66 | #include "path-prefix.h" | ||
342 | 67 | #endif | ||
343 | 68 | |||
344 | 65 | namespace Inkscape { | 69 | namespace Inkscape { |
345 | 66 | namespace Extension { | 70 | namespace Extension { |
346 | 67 | namespace Internal { | 71 | namespace Internal { |
347 | @@ -687,7 +691,8 @@ | |||
348 | 687 | // FIXES: Inkscape bug #956282, #1264793 | 691 | // FIXES: Inkscape bug #956282, #1264793 |
349 | 688 | // TODO: report RFE upstream (full relocation support for OS X packaging) | 692 | // TODO: report RFE upstream (full relocation support for OS X packaging) |
350 | 689 | // | 693 | // |
352 | 690 | gchar const *poppler_datadir = g_getenv("POPPLER_DATADIR"); | 694 | gchar const *poppler_datadir = OSX_APP_DATADIR( "/poppler" ); |
353 | 695 | //g_message("poppler_datadir: %s", poppler_datadir); | ||
354 | 691 | if (poppler_datadir != NULL) { | 696 | if (poppler_datadir != NULL) { |
355 | 692 | globalParams = new GlobalParams(poppler_datadir); | 697 | globalParams = new GlobalParams(poppler_datadir); |
356 | 693 | } else { | 698 | } else { |
357 | 694 | 699 | ||
358 | === modified file 'src/path-prefix.h' | |||
359 | --- src/path-prefix.h 2014-10-18 21:44:39 +0000 | |||
360 | +++ src/path-prefix.h 2015-11-20 12:21:31 +0000 | |||
361 | @@ -66,23 +66,23 @@ | |||
362 | 66 | # define CREATE_PALETTESDIR WIN32_DATADIR("create\\swatches") | 66 | # define CREATE_PALETTESDIR WIN32_DATADIR("create\\swatches") |
363 | 67 | # define CREATE_PATTERNSDIR WIN32_DATADIR("create\\patterns\\vector") | 67 | # define CREATE_PATTERNSDIR WIN32_DATADIR("create\\patterns\\vector") |
364 | 68 | # elif defined ENABLE_OSX_APP_LOCATIONS | 68 | # elif defined ENABLE_OSX_APP_LOCATIONS |
382 | 69 | # define INKSCAPE_APPICONDIR "Contents/Resources/share/pixmaps" | 69 | # define INKSCAPE_APPICONDIR OSX_APP_DATADIR( "/pixmaps" ) |
383 | 70 | # define INKSCAPE_ATTRRELDIR "Contents/Resources/share/inkscape/attributes" | 70 | # define INKSCAPE_ATTRRELDIR OSX_APP_DATADIR( "/inkscape/attributes" ) |
384 | 71 | # define INKSCAPE_BINDDIR "Contents/Resources/share/inkscape/bind" | 71 | # define INKSCAPE_BINDDIR OSX_APP_DATADIR( "/inkscape/bind" ) |
385 | 72 | # define INKSCAPE_EXAMPLESDIR "Contents/Resources/share/inkscape/examples" | 72 | # define INKSCAPE_EXAMPLESDIR OSX_APP_DATADIR( "/inkscape/examples" ) |
386 | 73 | # define INKSCAPE_EXTENSIONDIR "Contents/Resources/share/inkscape/extensions" | 73 | # define INKSCAPE_EXTENSIONDIR OSX_APP_DATADIR( "/inkscape/extensions" ) |
387 | 74 | # define INKSCAPE_FILTERDIR "Contents/Resources/share/inkscape/filters" | 74 | # define INKSCAPE_FILTERDIR OSX_APP_DATADIR( "/inkscape/filters" ) |
388 | 75 | # define INKSCAPE_GRADIENTSDIR "Contents/Resources/share/inkscape/gradients" | 75 | # define INKSCAPE_GRADIENTSDIR OSX_APP_DATADIR( "/inkscape/gradients" ) |
389 | 76 | # define INKSCAPE_KEYSDIR "Contents/Resources/share/inkscape/keys" | 76 | # define INKSCAPE_KEYSDIR OSX_APP_DATADIR( "/inkscape/keys" ) |
390 | 77 | # define INKSCAPE_PIXMAPDIR "Contents/Resources/share/inkscape/icons" | 77 | # define INKSCAPE_PIXMAPDIR OSX_APP_DATADIR( "/inkscape/icons" ) |
391 | 78 | # define INKSCAPE_MARKERSDIR "Contents/Resources/share/inkscape/markers" | 78 | # define INKSCAPE_MARKERSDIR OSX_APP_DATADIR( "/inkscape/markers" ) |
392 | 79 | # define INKSCAPE_PALETTESDIR "Contents/Resources/share/inkscape/palettes" | 79 | # define INKSCAPE_PALETTESDIR OSX_APP_DATADIR( "/inkscape/palettes" ) |
393 | 80 | # define INKSCAPE_PATTERNSDIR "Contents/Resources/share/inkscape/patterns" | 80 | # define INKSCAPE_PATTERNSDIR OSX_APP_DATADIR( "/inkscape/patterns" ) |
394 | 81 | # define INKSCAPE_SCREENSDIR "Contents/Resources/share/inkscape/screens" | 81 | # define INKSCAPE_SCREENSDIR OSX_APP_DATADIR( "/inkscape/screens" ) |
395 | 82 | # define INKSCAPE_SYMBOLSDIR "Contents/Resources/share/inkscape/symbols" | 82 | # define INKSCAPE_SYMBOLSDIR OSX_APP_DATADIR( "/inkscape/symbols" ) |
396 | 83 | # define INKSCAPE_TUTORIALSDIR "Contents/Resources/share/inkscape/tutorials" | 83 | # define INKSCAPE_TUTORIALSDIR OSX_APP_DATADIR( "/inkscape/tutorials" ) |
397 | 84 | # define INKSCAPE_TEMPLATESDIR "Contents/Resources/share/inkscape/templates" | 84 | # define INKSCAPE_TEMPLATESDIR OSX_APP_DATADIR( "/inkscape/templates" ) |
398 | 85 | # define INKSCAPE_UIDIR "Contents/Resources/share/inkscape/ui" | 85 | # define INKSCAPE_UIDIR OSX_APP_DATADIR( "/inkscape/ui" ) |
399 | 86 | //CREATE V0.1 support | 86 | //CREATE V0.1 support |
400 | 87 | # define CREATE_GRADIENTSDIR "/Library/Application Support/create/gradients/gimp" | 87 | # define CREATE_GRADIENTSDIR "/Library/Application Support/create/gradients/gimp" |
401 | 88 | # define CREATE_PALETTESDIR "/Library/Application Support/create/swatches" | 88 | # define CREATE_PALETTESDIR "/Library/Application Support/create/swatches" |
402 | 89 | 89 | ||
403 | === modified file 'src/prefix.cpp' | |||
404 | --- src/prefix.cpp 2014-10-08 02:22:03 +0000 | |||
405 | +++ src/prefix.cpp 2015-11-20 12:21:31 +0000 | |||
406 | @@ -491,5 +491,80 @@ | |||
407 | 491 | 491 | ||
408 | 492 | 492 | ||
409 | 493 | 493 | ||
410 | 494 | #ifdef ENABLE_OSX_APP_LOCATIONS | ||
411 | 495 | |||
412 | 496 | /* | ||
413 | 497 | * Provide a similar mechanism for osxapp. Enable a macro, | ||
414 | 498 | * OSX_APP_DATADIR, that can look up subpaths for inkscape resources | ||
415 | 499 | */ | ||
416 | 500 | |||
417 | 501 | static Glib::ustring osxapp_getDataDir() | ||
418 | 502 | { | ||
419 | 503 | const gchar *dir = NULL; | ||
420 | 504 | |||
421 | 505 | #ifdef WITH_MAC_INTEGRATION // Quartz-based app bundle with gtk-mac-integration | ||
422 | 506 | if (gtkosx_application_get_bundle_id()) { | ||
423 | 507 | dir = g_build_filename(gtkosx_application_get_resource_path(), "share", NULL); | ||
424 | 508 | } else { | ||
425 | 509 | dir = INKSCAPE_DATADIR; | ||
426 | 510 | } | ||
427 | 511 | #else // for X11- or Quartz-based app bundle without gtk-mac-integration | ||
428 | 512 | char exe_path[PATH_MAX + 1]; | ||
429 | 513 | uint32_t bufsize = sizeof(exe_path); | ||
430 | 514 | gchar *real_path; | ||
431 | 515 | gchar *bin_dir; | ||
432 | 516 | |||
433 | 517 | if ( _NSGetExecutablePath(exe_path, &bufsize) == 0 ) { | ||
434 | 518 | real_path = realpath(exe_path, NULL); | ||
435 | 519 | if (real_path) { | ||
436 | 520 | bin_dir = g_path_get_dirname(real_path); | ||
437 | 521 | #ifdef GDK_WINDOWING_QUARTZ | ||
438 | 522 | // from Inkscape.app/Contents/MacOS | ||
439 | 523 | // to Inkscape.app/Contents/Resources/share | ||
440 | 524 | dir = g_build_path(G_DIR_SEPARATOR_S, g_path_get_dirname(bin_dir), "Resources", "share", NULL); | ||
441 | 525 | #else | ||
442 | 526 | // from Inkscape.app/Contents/Resources/bin | ||
443 | 527 | // to Inkscape.app/Contents/Resources/share | ||
444 | 528 | dir = g_build_path(G_DIR_SEPARATOR_S, g_path_get_dirname(bin_dir), "share", NULL); | ||
445 | 529 | #endif /* GDK_WINDOWING_QUARTZ */ | ||
446 | 530 | //g_message("DataDir: %s", dir); | ||
447 | 531 | g_free(real_path); | ||
448 | 532 | g_free(bin_dir); | ||
449 | 533 | } | ||
450 | 534 | } | ||
451 | 535 | #endif /* WITH_MAC_INTEGRATION */ | ||
452 | 536 | Glib::ustring ret( dir ); | ||
453 | 537 | return ret; | ||
454 | 538 | } | ||
455 | 539 | |||
456 | 540 | |||
457 | 541 | static Glib::ustring osxapp_getResourcePath(const Glib::ustring &childPath) | ||
458 | 542 | { | ||
459 | 543 | Glib::ustring dir = osxapp_getDataDir(); | ||
460 | 544 | if (childPath.size() > 0) { | ||
461 | 545 | dir += childPath; | ||
462 | 546 | } | ||
463 | 547 | return dir; | ||
464 | 548 | } | ||
465 | 549 | |||
466 | 550 | /* | ||
467 | 551 | * This is the visible utility function | ||
468 | 552 | */ | ||
469 | 553 | char *osxapp_relative_path(const char *childPath) | ||
470 | 554 | { | ||
471 | 555 | static char *returnPath = 0; | ||
472 | 556 | if (!childPath) | ||
473 | 557 | childPath = ""; | ||
474 | 558 | Glib::ustring resourcePath = osxapp_getResourcePath(childPath); | ||
475 | 559 | if (returnPath) | ||
476 | 560 | free(returnPath); | ||
477 | 561 | returnPath = strdup(resourcePath.c_str()); | ||
478 | 562 | return returnPath; | ||
479 | 563 | } | ||
480 | 564 | |||
481 | 565 | #endif /* ENABLE_OSX_APP_LOCATIONS */ | ||
482 | 566 | |||
483 | 567 | |||
484 | 568 | |||
485 | 494 | 569 | ||
486 | 495 | #endif /* _PREFIX_C */ | 570 | #endif /* _PREFIX_C */ |
487 | 496 | 571 | ||
488 | === modified file 'src/prefix.h' | |||
489 | --- src/prefix.h 2014-10-08 02:22:03 +0000 | |||
490 | +++ src/prefix.h 2015-11-20 12:21:31 +0000 | |||
491 | @@ -129,4 +129,21 @@ | |||
492 | 129 | 129 | ||
493 | 130 | #endif | 130 | #endif |
494 | 131 | 131 | ||
495 | 132 | #ifdef ENABLE_OSX_APP_LOCATIONS | ||
496 | 133 | |||
497 | 134 | #ifdef WITH_MAC_INTEGRATION | ||
498 | 135 | #include <gtkmacintegration/gtkosxapplication.h> | ||
499 | 136 | #else | ||
500 | 137 | #include <mach-o/dyld.h> | ||
501 | 138 | #endif /* WITH_MAC_INTEGRATION */ | ||
502 | 139 | |||
503 | 140 | #include <glib.h> | ||
504 | 141 | #include <glibmm/ustring.h> | ||
505 | 142 | |||
506 | 143 | char *osxapp_relative_path(const char *childPath); | ||
507 | 144 | |||
508 | 145 | #define OSX_APP_DATADIR(suffix) (osxapp_relative_path(suffix)) | ||
509 | 146 | |||
510 | 147 | #endif /* ENABLE_OSX_APP_LOCATIONS */ | ||
511 | 148 | |||
512 | 132 | #endif /* _PREFIX_H_ */ | 149 | #endif /* _PREFIX_H_ */ |
513 | 133 | 150 | ||
514 | === modified file 'src/ui/dialog/inkscape-preferences.cpp' | |||
515 | --- src/ui/dialog/inkscape-preferences.cpp 2015-11-01 12:50:42 +0000 | |||
516 | +++ src/ui/dialog/inkscape-preferences.cpp 2015-11-20 12:21:31 +0000 | |||
517 | @@ -1987,7 +1987,15 @@ | |||
518 | 1987 | _sys_tmp_files.set_editable(false); | 1987 | _sys_tmp_files.set_editable(false); |
519 | 1988 | _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true); | 1988 | _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true); |
520 | 1989 | 1989 | ||
521 | 1990 | #ifdef ENABLE_BINRELOC | ||
522 | 1991 | _sys_data.set_text( BR_DATADIR("") ); | ||
523 | 1992 | #elif defined WIN32 | ||
524 | 1993 | _sys_data.set_text( WIN32_DATADIR("share") ); | ||
525 | 1994 | #elif defined ENABLE_OSX_APP_LOCATIONS | ||
526 | 1995 | _sys_data.set_text( OSX_APP_DATADIR("") ); | ||
527 | 1996 | #else | ||
528 | 1990 | _sys_data.set_text( INKSCAPE_DATADIR ); | 1997 | _sys_data.set_text( INKSCAPE_DATADIR ); |
529 | 1998 | #endif | ||
530 | 1991 | _sys_data.set_editable(false); | 1999 | _sys_data.set_editable(false); |
531 | 1992 | _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true); | 2000 | _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true); |
532 | 1993 | 2001 |
Is this merge request still useful and open? Should we get these changes into trunk?