on xenial help sign in
Clean up Mir startup and environment variable logic
e40217fMichael Terry
data/unity8.conf+34−35
@@ -8,31 +8,44 @@ stop on desktop-end
8
8
9kill timeout 120
9kill timeout 120
10
10
11+#
12+# Ensure the shell always gets unthrottled touch events, so that applications
13+# who want full speed low-latency input can get it (LP: #1497105) and so that
14+# apps can use QML touch compression safely (the QML touch compression
15+# algorithm does not support nesting well - LP: #1486341, LP: #1556763 - so
16+# must be fed by the raw input event stream from Unity8).
17+#
18+env QML_NO_TOUCH_COMPRESSION=1
19+
11respawn
20respawn
12expect stop
21expect stop
13
22
23+# FIXME Create an autopilot test that makes sure start+stop and restart
24+# work fine at least 2 times
25+
14pre-start script
26pre-start script
15 # Tell unity-mir to raise SIGSTOP after we start
27 # Tell unity-mir to raise SIGSTOP after we start
16 initctl set-env UNITY_MIR_EMITS_SIGSTOP=1
28 initctl set-env UNITY_MIR_EMITS_SIGSTOP=1
17
29
18− if [ -n "$MIR_SOCKET" ]; then
19− # FIXME Create an autopilot test that makes sure start+stop and restart
20− # work fine at least 2 times
21− # Save original value of MIR_SOCKET in case we are stopped,
30+ # Save original value of MIR_SOCKET so that we can restore it when stopped,
22− # as we modify the variable for future jobs, including ourself.
31+ # as we modify the variable for future jobs, including ourself.
23− UNITY_MIR_SOCKET=$(initctl get-env --global MIR_SOCKET)
24− initctl set-env --global UNITY_MIR_SOCKET=$UNITY_MIR_SOCKET
32+ initctl set-env UNITY_MIR_SOCKET=$MIR_SOCKET
25
33
26− # Point unity8 at unity-system-compositor
34+ # Decide where we are going to put our own socket file
35+ if [ -n "$SNAP" ]; then
36+ # In snappy, we want to hard code our path because our apparmor profile
37+ # only lets us put the socket in one place. And consumers expect it
38+ # there.
39+ MIR_SERVER_FILE=/run/user/$(id -u)/mir_socket
40+ else
27 MIR_SERVER_FILE=$XDG_RUNTIME_DIR/mir_socket
41 MIR_SERVER_FILE=$XDG_RUNTIME_DIR/mir_socket
28− initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE
29− initctl set-env MIR_SERVER_HOST_SOCKET=$UNITY_MIR_SOCKET
30−
31− # Point all future jobs in this session to our Mir socket instead of
32− # unity-system-compositor's socket.
33− initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE
34− gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}"
35 fi
42 fi
43+ initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE
44+
45+ # Point all future jobs in this session to our Mir socket instead of
46+ # unity-system-compositor's socket.
47+ initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE
48+ gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}"
36
49
37 # Remove the normal and trusted sockets if still there
50 # Remove the normal and trusted sockets if still there
38 if [ -S "$MIR_SERVER_FILE" ]; then
51 if [ -S "$MIR_SERVER_FILE" ]; then
@@ -45,16 +58,16 @@ pre-start script
45
58
46 initctl set-env --global MIR_SERVER_PROMPT_FILE=1
59 initctl set-env --global MIR_SERVER_PROMPT_FILE=1
47
60
48− #
61+ # Disable Qt's stuttering 'touch compression' to fix scrolling smoothness
49− # Mir's input resampling is deprecated and going away soon. Turn it off
62+
50− # so we don't get a surprise change in behaviour when that happens.
63+ # issues (LP: #1486341, LP: #1556763). As a bonus, this eliminates most of
51− #
64+ # the lag seen in the indicator panel pull-down (LP: #1488327) and also
65+ # reduces lag seen in apps:
52− initctl set-env --global MIR_CLIENT_INPUT_RATE=0
66+ initctl set-env --global QML_NO_TOUCH_COMPRESSION=1
53
67
54 # Workaround for text not rendering correctly
68 # Workaround for text not rendering correctly
55 initctl set-env --global QT_ENABLE_GLYPH_CACHE_WORKAROUND=1
69 initctl set-env --global QT_ENABLE_GLYPH_CACHE_WORKAROUND=1
56
70
57−
58 if [ "$XDG_SESSION_DESKTOP" = "ubuntu-touch" ]; then
71 if [ "$XDG_SESSION_DESKTOP" = "ubuntu-touch" ]; then
59 # On Ubuntu Touch, we currently use a trick where we auto-login the
72 # On Ubuntu Touch, we currently use a trick where we auto-login the
60 # user without a LightDM greeter at all. In this case, we want to
73 # user without a LightDM greeter at all. In this case, we want to
@@ -75,25 +88,11 @@ end script
75exec ${BINARY:-unity8} --mode=$MODE $ARGS
88exec ${BINARY:-unity8} --mode=$MODE $ARGS
76
89
77post-start script
90post-start script
78− # If no MIR_SOCKET was defined on launch, we try to set one here
79− if [ -z "$(initctl get-env --global UNITY_MIR_SOCKET)" ]; then
80− if [ -S "$XDG_RUNTIME_DIR/mir_socket" ]; then
81− mir_socket=$XDG_RUNTIME_DIR/mir_socket
82− elif [ -S "/tmp/mir_socket" ]; then
83− mir_socket=/tmp/mir_socket
84− fi
85−
86− if [ -n "$mir_socket" ]; then
87− initctl set-env --global MIR_SOCKET="$mir_socket"
88− fi
89− fi
90−
91 initctl emit --no-wait indicator-services-start
91 initctl emit --no-wait indicator-services-start
92end script
92end script
93
93
94post-stop script
94post-stop script
95 initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET
95 initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET
96− initctl unset-env --global UNITY_MIR_SOCKET
97 initctl unset-env --global MIR_SERVER_PROMPT_FILE
96 initctl unset-env --global MIR_SERVER_PROMPT_FILE
98 initctl emit application-end
97 initctl emit application-end
99end script
98end script