@@ -8,31 +8,44 @@ stop on desktop-end
88
99kill timeout 120
1010
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+
1120respawn
1221expect stop
1322
23+# FIXME Create an autopilot test that makes sure start+stop and restart
24+# work fine at least 2 times
25+
1426pre-start script
1527 # Tell unity-mir to raise SIGSTOP after we start
1628 initctl set-env UNITY_MIR_EMITS_SIGSTOP=1
1729
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,
22− # 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
30+ # Save original value of MIR_SOCKET so that we can restore it when stopped,
31+ # as we modify the variable for future jobs, including ourself.
32+ initctl set-env UNITY_MIR_SOCKET=$MIR_SOCKET
2533
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
2741 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'}"
3542 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'}"
3649
3750 # Remove the normal and trusted sockets if still there
3851 if [ -S "$MIR_SERVER_FILE" ]; then
@@ -45,16 +58,16 @@ pre-start script
4558
4659 initctl set-env --global MIR_SERVER_PROMPT_FILE=1
4760
48− #
49− # Mir's input resampling is deprecated and going away soon. Turn it off
50− # so we don't get a surprise change in behaviour when that happens.
51− #
52− initctl set-env --global MIR_CLIENT_INPUT_RATE=0
61+ # Disable Qt's stuttering 'touch compression' to fix scrolling smoothness
62+
63+ # issues (LP: #1486341, LP: #1556763). As a bonus, this eliminates most of
64+ # the lag seen in the indicator panel pull-down (LP: #1488327) and also
65+ # reduces lag seen in apps:
66+ initctl set-env --global QML_NO_TOUCH_COMPRESSION=1
5367
5468 # Workaround for text not rendering correctly
5569 initctl set-env --global QT_ENABLE_GLYPH_CACHE_WORKAROUND=1
5670
57−
5871 if [ "$XDG_SESSION_DESKTOP" = "ubuntu-touch" ]; then
5972 # On Ubuntu Touch, we currently use a trick where we auto-login the
6073 # user without a LightDM greeter at all. In this case, we want to
@@ -75,25 +88,11 @@ end script
7588exec ${BINARY:-unity8} --mode=$MODE $ARGS
7689
7790post-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−
9191 initctl emit --no-wait indicator-services-start
9292end script
9393
9494post-stop script
9595 initctl set-env --global MIR_SOCKET=$UNITY_MIR_SOCKET
96− initctl unset-env --global UNITY_MIR_SOCKET
9796 initctl unset-env --global MIR_SERVER_PROMPT_FILE
9897 initctl emit application-end
9998end script