logind: fix handle_action_valid()

This commit is contained in:
Ludwig Nussel 2022-02-23 08:49:56 +01:00
parent ba119ffcf9
commit 9fa9c66dbd
2 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ typedef enum HandleAction {
typedef struct ActionTableItem ActionTableItem;
#define handle_action_valid(x) (x && (x < _HANDLE_ACTION_MAX))
#define handle_action_valid(x) (x >= 0 && x < _HANDLE_ACTION_MAX)
#include "logind-inhibit.h"
#include "logind.h"

View File

@ -84,7 +84,7 @@ static void button_lid_switch_handle_action(Manager *manager, bool is_edge) {
* differently */
if (manager_is_docked_or_external_displays(manager))
handle_action = manager->handle_lid_switch_docked;
else if (!handle_action_valid(manager->handle_lid_switch_ep) && manager_is_on_external_power())
else if (handle_action_valid(manager->handle_lid_switch_ep) && manager_is_on_external_power())
handle_action = manager->handle_lid_switch_ep;
else
handle_action = manager->handle_lid_switch;