summaryrefslogtreecommitdiffstats
path: root/graphics/dia/patches/0013-Made-XQuartz-interaction-more-robust.patch
blob: f6e94044d3e08353ce35b1074c1e69b0cdfe1a8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From 5f85d269123d99d88a261d5dd775a80ef71ef76d Mon Sep 17 00:00:00 2001
From: Steffen Macke <sdteffen@sdteffen.de>
Date: Wed, 3 Jul 2013 09:19:26 +0200
Subject: [PATCH 13/24] Made XQuartz interaction more robust.

---
 installer/macosx/dia | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/installer/macosx/dia b/installer/macosx/dia
index 5b27386..61a676f 100755
--- a/installer/macosx/dia
+++ b/installer/macosx/dia
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
 # Author: Aaron Voisine <aaron@voisine.org>
-# Dia Modifications:
+# Modifications:
 #	Michael Wybrow <mjwybrow@users.sourceforge.net>
 #	Jean-Olivier Irisson <jo.irisson@gmail.com>
-#
+#       Steffen Macke <sdteffen@sdteffen.de>
 
 CWD="`(cd \"\`dirname \\\"$0\\\"\`\"; echo \"$PWD\")`"
 # e.g. /Applications/Dia.app/Contents/Resources/bin
@@ -24,7 +24,11 @@ TOP="`dirname \"$CWD\"`"
 #export PATH="/usr/texbin:/opt/local/bin:/sw/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:$CWD:$PATH"
 
 # Check for X11
-if [[ "" == `which startx` ]]; then
+if [[ "" == $DISPLAY ]]; then
+  export DISPLAY=:0
+fi
+startx=`which startx`
+if [[ "" == $startx ]]; then
  if [[ ! -e /opt/X11/bin/startx ]]; then
    osascript -e 'tell app "System Events" to display dialog "X11 (XQuartz) is not installed or not running. Would you like to visit xquartz.macosforge.org now in order to download and install XQuartz?" with icon 0'
    if [[ $? -eq 0 ]]; then
@@ -33,6 +37,17 @@ if [[ "" == `which startx` ]]; then
    fi
   fi
 fi
+osascript -e 'tell app "XQuartz" to launch'
+for i in `seq 1 30`; do
+  if [[ `ps aux | grep -v grep | grep startx | wc -l` -lt 1 ]]; then
+    sleep 1
+  fi
+done
+if [[ "$DISPLAY" =~ "/tmp" ]]; then
+  if [[ ! -e $DISPLAY ]]; then
+    export DISPLAY=:0
+  fi
+fi 
 
 # Setup PYTHONPATH to use python modules shipped with Dia
 ARCH=`arch`
-- 
1.8.4.4