diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-03-03 19:30:16 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-03-03 19:32:43 +0100 |
commit | 6a79c58603ea816a1b4fa1520397b4e138bc1ca0 (patch) | |
tree | 2300372efeda7924b759fffeb372b7c414c28b79 /src/login/logind-action.c | |
parent | ae833394d64e60edf558dec74c4780d88f788447 (diff) |
logind: ignore lid switch if more than 1 display is connected
Previously we expected the desktop environment to take an inhibitor
lock, but this opened a race on boot-up where logind might already be
running but no DE is active.
Hence, let's move checking for additional displays into logind. This
also opens up this logic for other DEs, given that only GNOME
implemented the inhibitor logic so far.
Diffstat (limited to 'src/login/logind-action.c')
-rw-r--r-- | src/login/logind-action.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/login/logind-action.c b/src/login/logind-action.c index c04f2107d1..da5a8305fa 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -72,10 +72,18 @@ int manager_handle_action( /* If we are docked don't react to lid closing */ if (inhibit_key == INHIBIT_HANDLE_LID_SWITCH) { + int n; + if (manager_is_docked(m)) { log_debug("Ignoring lid switch request, system is docked."); return 0; } + + n = manager_count_displays(m); + if (n != 1) { + log_debug("Ignoring lid switch request, %s displays connected."); + return 0; + } } /* If the key handling is inhibited, don't do anything */ |