summarylogtreecommitdiffstats
path: root/r600.diff
blob: ca82ae06a9703ec5e63236dc5d4f2ca84997d089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
diff -ru a/gtk-recordmydesktop/ChangeLog b/gtk-recordmydesktop/ChangeLog
--- a/gtk-recordmydesktop/ChangeLog	2008-11-23 16:05:38.000000000 +0100
+++ b/gtk-recordmydesktop/ChangeLog	2009-06-05 18:26:52.000000000 +0200
@@ -1,3 +1,7 @@
+/*VERSION 0.3.9 unreleased*/
+* Fix selection of window (including frame) on compiz
+* ...
+
 /*VERSION 0.3.8*/
 * nl.po added Dutch translation by Jos Poortvliet
 * Applied patch by freedo, to Replace GtkFileSelection with
diff -ru a/gtk-recordmydesktop/src/rmdSimple.py b/gtk-recordmydesktop/src/rmdSimple.py
--- a/gtk-recordmydesktop/src/rmdSimple.py	2008-07-12 19:45:50.000000000 +0200
+++ b/gtk-recordmydesktop/src/rmdSimple.py	2009-06-05 18:26:52.000000000 +0200
@@ -39,7 +39,9 @@
 import gtk.gdk
 import gobject
 import gc
+import sys
 import re
+from subprocess import Popen,PIPE
 import rmdPrefsWidget as pW
 import rmdSelectThumb as sT
 from rmdStrings import *
@@ -217,14 +219,39 @@
         self.__fileSelQuit__()
 
     def __select_window__(self,button):
-        xwininfo_com=['xwininfo','-frame']
-        if self.values[21]==1:
-            xwininfo_com=['xwininfo']
-        (stdin,stdout,stderr)=os.popen3(xwininfo_com,'t')
-        wid=stdout.readlines()
-        stdin.close()
-        stdout.close()
-        stderr.close()
+        # check user has not disabled capture of window decoration
+        if self.values[21]!=1:
+            # else work out the size including decoration (also taking into account compiz)
+            p = Popen(['xwininfo','-frame'],stdout=PIPE)
+            pattern = re.compile('^xwininfo: Window id: (0x[0-9a-fA-F]+)')
+
+            while True:
+               o = p.stdout.readline()
+               if o == '' and p.poll() != None: break
+               match = pattern.search(o)
+               if match:
+                   fid = match.group(1)
+                   break
+
+            p = Popen(['xprop','-id',fid,'_NET_FRAME_WINDOW'],stdout=PIPE)
+            pattern = re.compile('^_NET_FRAME_WINDOW\(WINDOW\): window id # (0x[0-9a-fA-F]+)')
+
+            while True:
+               o = p.stdout.readline()
+               if o == '' and p.poll() != None: break
+               match = pattern.search(o)
+               if match:
+                   wid = match.group(1)
+                   break
+               else:
+                   print pattern
+                   print o
+
+        if wid: xwininfo_com = ['xwininfo','-id',wid]
+        else: xwininfo_com = ['xwininfo']
+        p = Popen(xwininfo_com,stdout=PIPE)
+        wid=p.stdout.readlines()
+
         x=y=width=height=None
         for i in wid:
             if i.lstrip().startswith('Absolute upper-left X:'):