X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Flogin%2Flogind-button.c;h=8fdab789bcb346f2b73222d984376023bea7ba0e;hb=c846716a5a0c12eb9c7aa566da4666c50cdf2eba;hp=d0c9ccd83396fc30f8479cb93589960155588968;hpb=65b5116220a8ebf8a260716152409aa05377aacc;p=elogind.git diff --git a/src/login/logind-button.c b/src/login/logind-button.c index d0c9ccd83..8fdab789b 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -188,7 +188,7 @@ static int button_handle( } /* If the key handling is inhibited, don't do anything */ - if (manager_is_inhibited(b->manager, inhibit_key, INHIBIT_BLOCK, NULL, true)) { + if (manager_is_inhibited(b->manager, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0)) { log_debug("Refusing key handling, %s is inhibited.", inhibit_what_to_string(inhibit_key)); return 0; } @@ -197,7 +197,7 @@ static int button_handle( /* If the actual operation is inhibited, warn and fail */ if (!ignore_inhibited && - manager_is_inhibited(b->manager, inhibit_operation, INHIBIT_BLOCK, NULL, false)) { + manager_is_inhibited(b->manager, inhibit_operation, INHIBIT_BLOCK, NULL, false, false, 0)) { /* If this is just a recheck of the lid switch then don't warn about anything */ @@ -249,12 +249,21 @@ int button_process(Button *b) { log_info("Power key pressed."); return button_handle(b, INHIBIT_HANDLE_POWER_KEY, b->manager->handle_power_key, b->manager->power_key_ignore_inhibited, true); + /* The kernel is a bit confused here: + + KEY_SLEEP = suspend-to-ram, which everybody else calls "suspend" + KEY_SUSPEND = suspend-to-disk, which everybody else calls "hibernate" + */ + case KEY_SLEEP: - case KEY_SUSPEND: - log_info("Sleep key pressed."); - return button_handle(b, INHIBIT_HANDLE_SLEEP_KEY, b->manager->handle_sleep_key, b->manager->sleep_key_ignore_inhibited, true); + log_info("Suspend key pressed."); + return button_handle(b, INHIBIT_HANDLE_SUSPEND_KEY, b->manager->handle_suspend_key, b->manager->suspend_key_ignore_inhibited, true); + case KEY_SUSPEND: + log_info("Hibernate key pressed."); + return button_handle(b, INHIBIT_HANDLE_HIBERNATE_KEY, b->manager->handle_hibernate_key, b->manager->hibernate_key_ignore_inhibited, true); } + } else if (ev.type == EV_SW && ev.value > 0) { switch (ev.code) {