diff --git a/src/servers/power/Jamfile b/src/servers/power/Jamfile index 5921ebceb8..8e94eb969d 100644 --- a/src/servers/power/Jamfile +++ b/src/servers/power/Jamfile @@ -1,5 +1,7 @@ SubDir HAIKU_TOP src servers power ; +UsePrivateHeaders app ; + AddResources power_daemon : power_daemon.rdef ; Server power_daemon : diff --git a/src/servers/power/power_button_monitor.cpp b/src/servers/power/power_button_monitor.cpp index 8aee4dcd11..5fb6d91cf2 100644 --- a/src/servers/power/power_button_monitor.cpp +++ b/src/servers/power/power_button_monitor.cpp @@ -1,10 +1,10 @@ #include #include +#include + #include "power_button_monitor.h" -#define B_SYSTEM_SHUTDOWN 0x12d -static const char *kRosterSignature = "application/x-vnd.Be-ROST"; PowerButtonMonitor::PowerButtonMonitor() : BHandler ("power_button_monitor") { power_button_fd = open("/dev/power/button/power",O_RDONLY); @@ -22,9 +22,13 @@ void PowerButtonMonitor::MessageReceived(BMessage *msg) { if (power_button_fd <= 0) return; - bool button_pressed; + uint8 button_pressed; read(power_button_fd,&button_pressed,1); - if (button_pressed) - BMessenger(kRosterSignature).SendMessage(B_SYSTEM_SHUTDOWN); + if (button_pressed) { + BRoster roster; + BRoster::Private rosterPrivate(roster); + + rosterPrivate.ShutDown(false, false, false); + } }