summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes3
-rw-r--r--META.json4
-rw-r--r--META.yml4
-rw-r--r--Makefile.PL6
-rw-r--r--lib/App/XScreenSaver/DBus.pm4
-rw-r--r--lib/App/XScreenSaver/DBus/Logind.pm4
-rw-r--r--lib/App/XScreenSaver/DBus/Saver.pm20
-rw-r--r--lib/App/XScreenSaver/DBus/SaverProxy.pm41
-rwxr-xr-xscripts/xscreensaver-dbus4
9 files changed, 28 insertions, 62 deletions
diff --git a/Changes b/Changes
index 615dc8c..710a589 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+1.0.4 2023-10-22 21:03:17+01:00 Europe/London
+ - simpler proxy object
+
1.0.3 2021-05-06 15:16:13+01:00 Europe/London
- lock the screen when (e)logind says so
diff --git a/META.json b/META.json
index 97d3bbb..d41cef5 100644
--- a/META.json
+++ b/META.json
@@ -38,7 +38,7 @@
"Moo" : "0",
"Net::DBus" : "0",
"Net::DBus::Exporter" : "0",
- "Net::DBus::Object" : "0",
+ "Net::DBus::ProxyObject" : "0",
"Net::DBus::Reactor" : "0",
"Try::Tiny" : "0",
"curry" : "0",
@@ -66,7 +66,7 @@
"web" : "https://www.thenautilus.net/cgit/xscreensaver-dbus/"
}
},
- "version" : "1.0.3",
+ "version" : "1.0.4",
"x_generated_by_perl" : "v5.32.0",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.23",
"x_spdx_expression" : "AGPL-3.0"
diff --git a/META.yml b/META.yml
index ef49f6a..7f640bc 100644
--- a/META.yml
+++ b/META.yml
@@ -26,7 +26,7 @@ requires:
Moo: '0'
Net::DBus: '0'
Net::DBus::Exporter: '0'
- Net::DBus::Object: '0'
+ Net::DBus::ProxyObject: '0'
Net::DBus::Reactor: '0'
Try::Tiny: '0'
curry: '0'
@@ -37,7 +37,7 @@ requires:
warnings: '0'
resources:
repository: https://www.thenautilus.net/cgit/xscreensaver-dbus/
-version: 1.0.3
+version: 1.0.4
x_generated_by_perl: v5.32.0
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: AGPL-3.0
diff --git a/Makefile.PL b/Makefile.PL
index 3ea6d7d..b2d9755 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -26,7 +26,7 @@ my %WriteMakefileArgs = (
"Moo" => 0,
"Net::DBus" => 0,
"Net::DBus::Exporter" => 0,
- "Net::DBus::Object" => 0,
+ "Net::DBus::ProxyObject" => 0,
"Net::DBus::Reactor" => 0,
"Try::Tiny" => 0,
"curry" => 0,
@@ -41,7 +41,7 @@ my %WriteMakefileArgs = (
"IPC::Open3" => 0,
"Test::More" => 0
},
- "VERSION" => "1.0.3",
+ "VERSION" => "1.0.4",
"test" => {
"TESTS" => "t/*.t"
}
@@ -58,7 +58,7 @@ my %FallbackPrereqs = (
"Moo" => 0,
"Net::DBus" => 0,
"Net::DBus::Exporter" => 0,
- "Net::DBus::Object" => 0,
+ "Net::DBus::ProxyObject" => 0,
"Net::DBus::Reactor" => 0,
"Test::More" => 0,
"Try::Tiny" => 0,
diff --git a/lib/App/XScreenSaver/DBus.pm b/lib/App/XScreenSaver/DBus.pm
index 2a94677..990441d 100644
--- a/lib/App/XScreenSaver/DBus.pm
+++ b/lib/App/XScreenSaver/DBus.pm
@@ -6,7 +6,7 @@ use Net::DBus::Reactor;
use Log::Any;
use App::XScreenSaver::DBus::Logind;
use App::XScreenSaver::DBus::Saver;
-our $VERSION = '1.0.3'; # VERSION
+our $VERSION = '1.0.4'; # VERSION
# ABSTRACT: tie xscreensaver into dbus
@@ -53,7 +53,7 @@ App::XScreenSaver::DBus - tie xscreensaver into dbus
=head1 VERSION
-version 1.0.3
+version 1.0.4
=head1 SYNOPSIS
diff --git a/lib/App/XScreenSaver/DBus/Logind.pm b/lib/App/XScreenSaver/DBus/Logind.pm
index 0c2abee..0aea3c3 100644
--- a/lib/App/XScreenSaver/DBus/Logind.pm
+++ b/lib/App/XScreenSaver/DBus/Logind.pm
@@ -6,7 +6,7 @@ use curry;
use Net::DBus;
use IPC::Run;
use Log::Any;
-our $VERSION = '1.0.3'; # VERSION
+our $VERSION = '1.0.4'; # VERSION
# ABSTRACT: implements the logind "inhibitor locks" and "session lock" protocols
@@ -120,7 +120,7 @@ App::XScreenSaver::DBus::Logind - implements the logind "inhibitor locks" and "s
=head1 VERSION
-version 1.0.3
+version 1.0.4
=head1 SYNOPSIS
diff --git a/lib/App/XScreenSaver/DBus/Saver.pm b/lib/App/XScreenSaver/DBus/Saver.pm
index ab6339a..723a82b 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.3'; # VERSION
+our $VERSION = '1.0.4'; # VERSION
# ABSTRACT: implements the "idle inhibition" protocol
@@ -46,22 +46,18 @@ 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->@* ]);
@@ -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.3
+version 1.0.4
=head1 SYNOPSIS
diff --git a/lib/App/XScreenSaver/DBus/SaverProxy.pm b/lib/App/XScreenSaver/DBus/SaverProxy.pm
index 250d709..32931ad 100644
--- a/lib/App/XScreenSaver/DBus/SaverProxy.pm
+++ b/lib/App/XScreenSaver/DBus/SaverProxy.pm
@@ -2,38 +2,14 @@ package App::XScreenSaver::DBus::SaverProxy;
use v5.20;
use strict;
use warnings;
-use experimental qw(signatures postderef);
# this is the interface name
use Net::DBus::Exporter qw(org.freedesktop.ScreenSaver);
-use parent 'Net::DBus::Object';
-our $VERSION = '1.0.3'; # VERSION
+use parent 'Net::DBus::ProxyObject';
+our $VERSION = '1.0.4'; # VERSION
# ABSTRACT: proxy dbus object
-
-dbus_method('Inhibit',['string','string'],['uint32']);
-dbus_method('UnInhibit',['uint32'],[]);
-
-sub new($class,$service,$path,$inhibit_cb,$uninhibit_cb) {
- my $self = $class->SUPER::new($service, $path);
- bless $self, $class;
- $self->{__inhibit_cb} = $inhibit_cb;
- $self->{__uninhibit_cb} = $uninhibit_cb;
- return $self;
-}
-
-our $_message;
-sub _dispatch_object($self,$connection,$message,@etc) {
- local $_message = $message;
- return $self->SUPER::_dispatch_object($connection,$message,@etc);
-}
-
-sub Inhibit($self,$name,$reason) {
- return $self->{__inhibit_cb}->($name,$reason,$_message);
-}
-
-sub UnInhibit($self,$cookie) {
- return $self->{__uninhibit_cb}->($cookie,$_message);
-}
+dbus_method('Inhibit',['string','string','caller'],['uint32']);
+dbus_method('UnInhibit',['uint32','caller'],[]);
1;
@@ -49,14 +25,7 @@ App::XScreenSaver::DBus::SaverProxy - proxy dbus object
=head1 VERSION
-version 1.0.3
-
-=head1 DESCRIPTION
-
-This is functionally the same as L<< C<Net::DBus::ObjectProxy> >>, but
-specialised for this application, and with a hack to allow L<<
-C<App::XScreenSaver::DBus::Saver> >> to access the sender of the
-message.
+version 1.0.4
=head1 AUTHOR
diff --git a/scripts/xscreensaver-dbus b/scripts/xscreensaver-dbus
index 51ed55e..21d842d 100755
--- a/scripts/xscreensaver-dbus
+++ b/scripts/xscreensaver-dbus
@@ -4,7 +4,7 @@ use warnings;
use v5.20;
use Log::Any::Adapter Stdout => ( log_level => 'debug' );
use App::XScreenSaver::DBus;
-our $VERSION = '1.0.3'; # VERSION
+our $VERSION = '1.0.4'; # VERSION
# PODNAME: xscreensaver-dbus
# ABSTRACT: tie xscreensaver into dbus
@@ -23,7 +23,7 @@ xscreensaver-dbus - tie xscreensaver into dbus
=head1 VERSION
-version 1.0.3
+version 1.0.4
=head1 SYNOPSIS