Skip to content

Commit

Permalink
Don't check the logind CanGraphical seat property unless login-check-…
Browse files Browse the repository at this point in the history
…graphical option is set to true. There are too many cases of drivers that don't set the appropriate flags for this feature to work
  • Loading branch information
robert-ancell committed Sep 10, 2014
1 parent dccfe45 commit 9c84285
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 3 deletions.
2 changes: 2 additions & 0 deletions data/lightdm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# lock-memory = True to prevent memory from being paged to disk
# user-authority-in-system-dir = True if session authority should be in the system location
# guest-account-script = Script to be run to setup guest account
# logind-check-graphical = True to on start seats that are marked as graphical by logind
# log-directory = Directory to log information to
# run-directory = Directory to put running state in
# cache-directory = Directory to cache to
Expand All @@ -23,6 +24,7 @@
#lock-memory=true
#user-authority-in-system-dir=false
#guest-account-script=guest-account
#logind-check-graphical=false
#log-directory=/var/log/lightdm
#run-directory=/var/run/lightdm
#cache-directory=/var/cache/lightdm
Expand Down
9 changes: 6 additions & 3 deletions src/lightdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,8 @@ seat_stopped_cb (Seat *seat, Login1Seat *login1_seat)
static gboolean
update_login1_seat (Login1Seat *login1_seat)
{
if (login1_seat_get_can_graphical (login1_seat))
if (!config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical") ||
login1_seat_get_can_graphical (login1_seat))
{
Seat *seat;

Expand Down Expand Up @@ -1062,7 +1063,8 @@ login1_service_seat_added_cb (Login1Service *service, Login1Seat *login1_seat)
else
g_debug ("Seat %s added from logind without graphical output", login1_seat_get_id (login1_seat));

g_signal_connect (login1_seat, "can-graphical-changed", G_CALLBACK (login1_can_graphical_changed_cb), NULL);
if (config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical"))
g_signal_connect (login1_seat, "can-graphical-changed", G_CALLBACK (login1_can_graphical_changed_cb), NULL);
update_login1_seat (login1_seat);
}

Expand Down Expand Up @@ -1418,7 +1420,8 @@ main (int argc, char **argv)
for (link = login1_service_get_seats (login1_service_get_instance ()); link; link = link->next)
{
Login1Seat *login1_seat = link->data;
g_signal_connect (login1_seat, "can-graphical-changed", G_CALLBACK (login1_can_graphical_changed_cb), NULL);
if (config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical"))
g_signal_connect (login1_seat, "can-graphical-changed", G_CALLBACK (login1_can_graphical_changed_cb), NULL);
if (!update_login1_seat (login1_seat))
return EXIT_FAILURE;
}
Expand Down
6 changes: 6 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,11 @@ TESTS = \
test-xdmcp-server-open-file-descriptors \
test-multi-seat \
test-multi-seat-seat0-non-graphical \
test-multi-seat-seat0-non-graphical-disabled \
test-multi-seat-non-graphical \
test-multi-seat-non-graphical-disabled \
test-multi-seat-change-graphical \
test-multi-seat-change-graphical-disabled \
test-mir-autologin \
test-mir-greeter \
test-mir-session \
Expand Down Expand Up @@ -448,8 +451,11 @@ EXTRA_DIST = \
scripts/mir-session-crash.conf \
scripts/multi-seat.conf \
scripts/multi-seat-change-graphical.conf \
scripts/multi-seat-change-graphical-disabled.conf \
scripts/multi-seat-non-graphical.conf \
scripts/multi-seat-non-graphical-disabled.conf \
scripts/multi-seat-seat0-non-graphical.conf \
scripts/multi-seat-seat0-non-graphical-disabled.conf \
scripts/no-accounts-service.conf \
scripts/no-config.conf \
scripts/no-console-kit.conf \
Expand Down
53 changes: 53 additions & 0 deletions tests/scripts/multi-seat-change-graphical-disabled.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Check seat graphical status is ignored
#

#?*START-DAEMON
#?RUNNER DAEMON-START

# seat0 starts
#?XSERVER-0 START VT=7 SEAT=seat0
#?*XSERVER-0 INDICATE-READY
#?XSERVER-0 INDICATE-READY
#?XSERVER-0 ACCEPT-CONNECT
#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
#?LOGIN1 ACTIVATE-SESSION SESSION=c0
#?XSERVER-0 ACCEPT-CONNECT
#?GREETER-X-0 CONNECT-XSERVER
#?GREETER-X-0 CONNECT-TO-DAEMON
#?GREETER-X-0 CONNECTED-TO-DAEMON

# Add seat1
#?*ADD-SEAT ID=seat1

# seat1 starts
#?XSERVER-1 START SEAT=seat1 SHAREVTS=TRUE
#?*XSERVER-1 INDICATE-READY
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
#?GREETER-X-1 START XDG_SEAT=seat1 XDG_SESSION_CLASS=greeter
#?LOGIN1 ACTIVATE-SESSION SESSION=c1
#?XSERVER-1 ACCEPT-CONNECT
#?GREETER-X-1 CONNECT-XSERVER
#?GREETER-X-1 CONNECT-TO-DAEMON
#?GREETER-X-1 CONNECTED-TO-DAEMON

# Remove graphical status from seat
#?*UPDATE-SEAT ID=seat1 CAN-GRAPHICAL=FALSE

# Nothing happens
#?*WAIT

# Add graphical status back
#?*UPDATE-SEAT ID=seat1 CAN-GRAPHICAL=TRUE

# Nothing happens
#?*WAIT

# Cleanup
#?*STOP-DAEMON
#?GREETER-X-0 TERMINATE SIGNAL=15
#?XSERVER-0 TERMINATE SIGNAL=15
#?GREETER-X-1 TERMINATE SIGNAL=15
#?XSERVER-1 TERMINATE SIGNAL=15
#?RUNNER DAEMON-EXIT STATUS=0
3 changes: 3 additions & 0 deletions tests/scripts/multi-seat-change-graphical.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Check seat can change graphical status
#

[LightDM]
logind-check-graphical=true

#?*START-DAEMON
#?RUNNER DAEMON-START

Expand Down
41 changes: 41 additions & 0 deletions tests/scripts/multi-seat-non-graphical-disabled.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Check non graphical seats are started anyway
#

#?*START-DAEMON
#?RUNNER DAEMON-START

# seat0 starts
#?XSERVER-0 START VT=7 SEAT=seat0
#?*XSERVER-0 INDICATE-READY
#?XSERVER-0 INDICATE-READY
#?XSERVER-0 ACCEPT-CONNECT
#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
#?LOGIN1 ACTIVATE-SESSION SESSION=c0
#?XSERVER-0 ACCEPT-CONNECT
#?GREETER-X-0 CONNECT-XSERVER
#?GREETER-X-0 CONNECT-TO-DAEMON
#?GREETER-X-0 CONNECTED-TO-DAEMON

# Add seat1
#?*ADD-SEAT ID=seat1 CAN-GRAPHICAL=FALSE

# seat1 starts
#?XSERVER-1 START SEAT=seat1 SHAREVTS=TRUE
#?*XSERVER-1 INDICATE-READY
#?XSERVER-1 INDICATE-READY
#?XSERVER-1 ACCEPT-CONNECT
#?GREETER-X-1 START XDG_SEAT=seat1 XDG_SESSION_CLASS=greeter
#?LOGIN1 ACTIVATE-SESSION SESSION=c1
#?XSERVER-1 ACCEPT-CONNECT
#?GREETER-X-1 CONNECT-XSERVER
#?GREETER-X-1 CONNECT-TO-DAEMON
#?GREETER-X-1 CONNECTED-TO-DAEMON

# Cleanup
#?*STOP-DAEMON
#?GREETER-X-0 TERMINATE SIGNAL=15
#?XSERVER-0 TERMINATE SIGNAL=15
#?GREETER-X-1 TERMINATE SIGNAL=15
#?XSERVER-1 TERMINATE SIGNAL=15
#?RUNNER DAEMON-EXIT STATUS=0
3 changes: 3 additions & 0 deletions tests/scripts/multi-seat-non-graphical.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Check non graphical seats are ignored
#

[LightDM]
logind-check-graphical=true

#?*START-DAEMON
#?RUNNER DAEMON-START

Expand Down
27 changes: 27 additions & 0 deletions tests/scripts/multi-seat-seat0-non-graphical-disabled.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Check seat0 is started even if it is marked as non-graphical
#

[test-runner-config]
seat0-can-graphical=false

#?*START-DAEMON
#?RUNNER DAEMON-START

# seat0 starts
#?XSERVER-0 START VT=7 SEAT=seat0
#?*XSERVER-0 INDICATE-READY
#?XSERVER-0 INDICATE-READY
#?XSERVER-0 ACCEPT-CONNECT
#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
#?LOGIN1 ACTIVATE-SESSION SESSION=c0
#?XSERVER-0 ACCEPT-CONNECT
#?GREETER-X-0 CONNECT-XSERVER
#?GREETER-X-0 CONNECT-TO-DAEMON
#?GREETER-X-0 CONNECTED-TO-DAEMON

# Cleanup
#?*STOP-DAEMON
#?GREETER-X-0 TERMINATE SIGNAL=15
#?XSERVER-0 TERMINATE SIGNAL=15
#?RUNNER DAEMON-EXIT STATUS=0
3 changes: 3 additions & 0 deletions tests/scripts/multi-seat-seat0-non-graphical.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Check seat0 is started only once it becomes graphical
#

[LightDM]
logind-check-graphical=true

[test-runner-config]
seat0-can-graphical=false

Expand Down
2 changes: 2 additions & 0 deletions tests/test-multi-seat-change-graphical-disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner multi-seat-change-graphical-disabled test-gobject-greeter
2 changes: 2 additions & 0 deletions tests/test-multi-seat-non-graphical-disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner multi-seat-non-graphical-disabled test-gobject-greeter
2 changes: 2 additions & 0 deletions tests/test-multi-seat-seat0-non-graphical-disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner multi-seat-seat0-non-graphical-disabled test-gobject-greeter

0 comments on commit 9c84285

Please sign in to comment.