~ubuntu-branches/ubuntu/wily/xdg-utils/wily

« back to all changes in this revision

Viewing changes to debian/patches/xdg-screensaver-new-gnome.diff

  • Committer: Package Import Robot
  • Author(s): Sean Davis
  • Date: 2015-09-13 12:39:10 UTC
  • mfrom: (13.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20150913123910-uba8c1sph2iwnqlr
Tags: 1.1.0~rc3+git20150907-1ubuntu1
* Merge from Debian unstable.  Remaining changes: (LP: #1495273)
  - debian/patches:
    * gnome-3.0.diff: Correctly open preferred browser with 
      gnome-open (LP: #670128)
    * lp779156-lubuntu.diff: Add open_lxde and run_sylpheed function
      for improved LXDE and sylpheed support (LP: #779156)
    * xdg-screensaver-restore-timeout.diff: restore previous X11 
      screensaver timeout when xdg-screensaver resume is used (LP: #1363540)
* New upstream release fixes the following bugs:
  - xdg-mime query filetype does not work on KDE 5 (LP: #1454833)
  - xdg-open doesn't properly detect Xfce/Xubuntu (LP: #1388922)
  - xserver-blanking patch in Ubuntu duplicates code (LP: #1330386)
  - Typo in manpage of 'xdg-icon-resource' (LP: #996304)
  - xdg-open (to gnome-open) fails to launch file:// URL with query string 
    (LP: #396162)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Use DBus API for GNOME since gnome-screensaver-command --poke
 
2
        has been removed
 
3
Author: Ben Hutchings <ben@decadent.org.uk>
 
4
Bug: http://bugs.debian.org/610155
 
5
 
 
6
--- a/scripts/xdg-screensaver.in
 
7
+++ b/scripts/xdg-screensaver.in
 
8
@@ -442,14 +442,54 @@ screensaver_gnome_screensaver()
 
9
 # http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html
 
10
     case "$1" in
 
11
         suspend)
 
12
-        screensaver_suspend_loop \
 
13
-        dbus-send --session \
 
14
-                  --dest=org.gnome.ScreenSaver \
 
15
-                  --type=method_call \
 
16
-                  /org/gnome/ScreenSaver \
 
17
-                  org.gnome.ScreenSaver.SimulateUserActivity \
 
18
-                  2> /dev/null
 
19
-        result=$?
 
20
+        perl -e '
 
21
+use strict;
 
22
+use warnings;
 
23
+use IO::File;
 
24
+use Net::DBus;
 
25
+use X11::Protocol;
 
26
+
 
27
+my ($window_id, $screensaver_file) = @ARGV;
 
28
+
 
29
+# Find window name to pass to session manager.
 
30
+my $x = X11::Protocol->new();
 
31
+my $named_window_id = hex($window_id);
 
32
+my $window_name;
 
33
+while (1) {
 
34
+  ($window_name) = $x->GetProperty($named_window_id, $x->atom("WM_NAME"),
 
35
+                                  $x->atom("STRING"), 0, 1000, 0);
 
36
+  last if defined($window_name) && $window_name ne "";
 
37
+  (undef, $named_window_id) = $x->QueryTree($named_window_id);
 
38
+  if (!defined($named_window_id)) {
 
39
+    $window_name = "?";
 
40
+    last;
 
41
+  }
 
42
+}
 
43
+
 
44
+# Inhibit idle detection (flags = 8) with window name and ID.
 
45
+# We have no reason so just send the window name again.
 
46
+my $bus = Net::DBus->session();
 
47
+my $sm_svc = $bus->get_service("org.gnome.SessionManager");
 
48
+my $sm = $sm_svc->get_object("/org/gnome/SessionManager",
 
49
+                            "org.gnome.SessionManager");
 
50
+$sm->Inhibit($window_name, hex($window_id), $window_name, 8);
 
51
+
 
52
+# Wait until removed from the status file.
 
53
+while (1) {
 
54
+  sleep(10);
 
55
+  my $status = new IO::File($screensaver_file, "r")
 
56
+    or exit 0;
 
57
+  my $found;
 
58
+  while (<$status>) {
 
59
+    if (/^$window_id:/) {
 
60
+      $found = 1;
 
61
+      last;
 
62
+    }
 
63
+  }
 
64
+  exit 0 unless $found;
 
65
+}
 
66
+' $window_id $screensaver_file &
 
67
+        result=0
 
68
         ;;
 
69
 
 
70
         resume)