forked from pool/xdg-utils
bded640d58
Fixing bug "xdg-screensaver suspend WindowID does not inhibit screensaver" https://bugzilla.novell.com/show_bug.cgi?id=559110 Adds 3 patches: http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=7465b22a95e9a28e3f4960e6ea40a4abeca1c2e9 http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=666d65cae0f2e66d33ec0dc48c054afbf16c9e3f http://patch-tracker.debian.org/patch/series/view/xdg-utils/1.1.0~rc1+git20111210-6/xdg-screensaver-new-gnome.diff Depends on perl-X11-Protocol Request 121743 to complete first: https://build.opensuse.org/request/show/121743 OBS-URL: https://build.opensuse.org/request/show/121894 OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/xdg-utils?expand=0&rev=16
67 lines
2.0 KiB
Diff
67 lines
2.0 KiB
Diff
Source of the patch: http://patch-tracker.debian.org/patch/series/view/xdg-utils/1.1.0~rc1+git20111210-6/xdg-screensaver-new-gnome.diff
|
|
--- scripts/xdg-screensaver 2012-05-21 12:58:36.269876261 +0200
|
|
+++ scripts/xdg-screensaver 2012-05-21 13:01:12.328342683 +0200
|
|
@@ -617,14 +617,54 @@
|
|
# http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html
|
|
case "$1" in
|
|
suspend)
|
|
- screensaver_suspend_loop \
|
|
- dbus-send --session \
|
|
- --dest=org.gnome.ScreenSaver \
|
|
- --type=method_call \
|
|
- /org/gnome/ScreenSaver \
|
|
- org.gnome.ScreenSaver.SimulateUserActivity \
|
|
- 2> /dev/null
|
|
- result=$?
|
|
+ perl -e '
|
|
+use strict;
|
|
+use warnings;
|
|
+use IO::File;
|
|
+use Net::DBus;
|
|
+use X11::Protocol;
|
|
+
|
|
+my ($window_id, $screensaver_file) = @ARGV;
|
|
+
|
|
+# Find window name to pass to session manager.
|
|
+my $x = X11::Protocol->new();
|
|
+my $named_window_id = hex($window_id);
|
|
+my $window_name;
|
|
+while (1) {
|
|
+ ($window_name) = $x->GetProperty($named_window_id, $x->atom("WM_NAME"),
|
|
+ $x->atom("STRING"), 0, 1000, 0);
|
|
+ last if defined($window_name) && $window_name ne "";
|
|
+ (undef, $named_window_id) = $x->QueryTree($named_window_id);
|
|
+ if (!defined($named_window_id)) {
|
|
+ $window_name = "?";
|
|
+ last;
|
|
+ }
|
|
+}
|
|
+
|
|
+# Inhibit idle detection (flags = 8) with window name and ID.
|
|
+# We have no reason so just send the window name again.
|
|
+my $bus = Net::DBus->session();
|
|
+my $sm_svc = $bus->get_service("org.gnome.SessionManager");
|
|
+my $sm = $sm_svc->get_object("/org/gnome/SessionManager",
|
|
+ "org.gnome.SessionManager");
|
|
+$sm->Inhibit($window_name, hex($window_id), $window_name, 8);
|
|
+
|
|
+# Wait until removed from the status file.
|
|
+while (1) {
|
|
+ sleep(10);
|
|
+ my $status = new IO::File($screensaver_file, "r")
|
|
+ or exit 0;
|
|
+ my $found;
|
|
+ while (<$status>) {
|
|
+ if (/^$window_id:/) {
|
|
+ $found = 1;
|
|
+ last;
|
|
+ }
|
|
+ }
|
|
+ exit 0 unless $found;
|
|
+}
|
|
+' $window_id $screensaver_file &
|
|
+ result=0
|
|
;;
|
|
|
|
resume)
|