summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-03-11 22:38:54 +0100
committerKay Sievers <kay@vrfy.org>2014-03-11 22:43:11 +0100
commitb5d3e1688133077ca20542a20dcd8919147e72e1 (patch)
tree0a2c28b85c7042d05a163618b8148d15c2beeeb2
parent4ef0809c22a7d15bae3865d44596ff6e3cdaf1cb (diff)
logind: move lid switch handling from logind-main to logind-core
../src/login/logind-dbus.c:1352: error: undefined reference to 'manager_set_lid_switch_ignore' collect2: error: ld returned 1 exit status make[2]: *** [test-login-tables]
-rw-r--r--src/login/logind-dbus.c40
-rw-r--r--src/login/logind.c40
2 files changed, 40 insertions, 40 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index c5f9cb3930..2ef87f72aa 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1305,6 +1305,46 @@ static int bus_manager_log_shutdown(
q, NULL);
}
+static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) {
+ Manager *m = userdata;
+
+ assert(e);
+ assert(m);
+
+ m->lid_switch_ignore_event_source = sd_event_source_unref(m->lid_switch_ignore_event_source);
+ return 0;
+}
+
+int manager_set_lid_switch_ignore(Manager *m, usec_t until) {
+ int r;
+
+ assert(m);
+
+ if (until <= now(CLOCK_MONOTONIC))
+ return 0;
+
+ /* We want to ignore the lid switch for a while after each
+ * suspend, and after boot-up. Hence let's install a timer for
+ * this. As long as the event source exists we ignore the lid
+ * switch. */
+
+ if (m->lid_switch_ignore_event_source) {
+ usec_t u;
+
+ r = sd_event_source_get_time(m->lid_switch_ignore_event_source, &u);
+ if (r < 0)
+ return r;
+
+ if (until <= u)
+ return 0;
+
+ r = sd_event_source_set_time(m->lid_switch_ignore_event_source, until);
+ } else
+ r = sd_event_add_monotonic(m->event, &m->lid_switch_ignore_event_source, until, 0, lid_switch_ignore_handler, m);
+
+ return r;
+}
+
static int execute_shutdown_or_sleep(
Manager *m,
InhibitWhat w,
diff --git a/src/login/logind.c b/src/login/logind.c
index 03b77539bd..2d734ff26f 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -962,46 +962,6 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us
return 0;
}
-static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) {
- Manager *m = userdata;
-
- assert(e);
- assert(m);
-
- m->lid_switch_ignore_event_source = sd_event_source_unref(m->lid_switch_ignore_event_source);
- return 0;
-}
-
-int manager_set_lid_switch_ignore(Manager *m, usec_t until) {
- int r;
-
- assert(m);
-
- if (until <= now(CLOCK_MONOTONIC))
- return 0;
-
- /* We want to ignore the lid switch for a while after each
- * suspend, and after boot-up. Hence let's install a timer for
- * this. As long as the event source exists we ignore the lid
- * switch. */
-
- if (m->lid_switch_ignore_event_source) {
- usec_t u;
-
- r = sd_event_source_get_time(m->lid_switch_ignore_event_source, &u);
- if (r < 0)
- return r;
-
- if (until <= u)
- return 0;
-
- r = sd_event_source_set_time(m->lid_switch_ignore_event_source, until);
- } else
- r = sd_event_add_monotonic(m->event, &m->lid_switch_ignore_event_source, until, 0, lid_switch_ignore_handler, m);
-
- return r;
-}
-
int manager_startup(Manager *m) {
int r;
Seat *seat;