summaryrefslogtreecommitdiff
path: root/lib/App/XScreenSaver/DBus/Saver.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/XScreenSaver/DBus/Saver.pm')
-rw-r--r--lib/App/XScreenSaver/DBus/Saver.pm22
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/App/XScreenSaver/DBus/Saver.pm b/lib/App/XScreenSaver/DBus/Saver.pm
index 196c418..c36bece 100644
--- a/lib/App/XScreenSaver/DBus/Saver.pm
+++ b/lib/App/XScreenSaver/DBus/Saver.pm
@@ -7,7 +7,7 @@ use Log::Any;
use Try::Tiny;
use IPC::Run;
use App::XScreenSaver::DBus::SaverProxy;
-our $VERSION = '1.0.2'; # VERSION
+our $VERSION = '1.0.5'; # VERSION
# ABSTRACT: implements the "idle inhibition" protocol
@@ -46,28 +46,24 @@ has paths => (
has log => ( is => 'lazy', builder => sub { Log::Any->get_logger } );
-has _impls => ( is => 'rw' );
+has _proxies => ( is => 'rw' );
has _prod_id => ( is => 'rw' );
has _inhibits => ( is => 'rw', default => sub { +{} } );
sub start($self) {
- my $inhibit_cb = $self->curry::weak::_inhibit;
- my $uninhibit_cb = $self->curry::weak::_uninhibit;
-
# export to dbus
- $self->_impls([ map {
+ $self->_proxies([ map {
App::XScreenSaver::DBus::SaverProxy->new(
$self->service,
$_,
- $inhibit_cb,
- $uninhibit_cb,
+ $self,
)
} $self->paths->@* ]);
$self->_prod_id(
$self->reactor->add_timeout(
- 5_000,
+ 60_000,
Net::DBus::Callback->new(
method => $self->curry::weak::_prod_screensaver
),
@@ -83,13 +79,12 @@ sub start($self) {
return;
}
-sub _inhibit($self,$name,$reason,$message) {
+sub Inhibit($self,$name,$reason,$sender) {
my $cookie;
do {
$cookie = int(rand(2**31))
} until !exists $self->_inhibits->{$cookie};
- my $sender = $message->get_sender;
$self->_inhibits->{$cookie} = [ $name, $reason, $sender ];
$self->log->debugf(
@@ -103,11 +98,10 @@ sub _inhibit($self,$name,$reason,$message) {
return $cookie;
}
-sub _uninhibit($self,$cookie,$message) {
+sub UnInhibit($self,$cookie,$this_sender) {
my $inhibit = delete $self->_inhibits->{$cookie}
or return;
my ($name, $reason, $sender) = @$inhibit;
- my $this_sender = $message->get_sender;
$self->log->debugf(
'<%s> (was %s, is %s) resumed screensaver for <%s> (cookie %d) - %d left',
@@ -172,7 +166,7 @@ App::XScreenSaver::DBus::Saver - implements the "idle inhibition" protocol
=head1 VERSION
-version 1.0.2
+version 1.0.5
=head1 SYNOPSIS