Merge lp:~rakete/eidete/scratching-my-itches into lp:eidete
- scratching-my-itches
- Merge into trunk
Status: | Merged |
---|---|
Merge reported by: | Tom Beckmann |
Merged at revision: | not available |
Proposed branch: | lp:~rakete/eidete/scratching-my-itches |
Merge into: | lp:eidete |
Diff against target: |
614 lines (+232/-90) 5 files modified
src/Widgets/end_dialog.vala (+5/-3) src/Widgets/keyview.vala (+111/-15) src/Widgets/selectionarea.vala (+15/-12) src/eidete.vala (+88/-57) src/keycapture.c (+13/-3) |
To merge this branch: | bzr merge lp:~rakete/eidete/scratching-my-itches |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tom Beckmann (community) | Approve | ||
Review via email: mp+99500@code.launchpad.net |
Commit message
Description of the change
Focusing to stop recording wouldn't work, a missing save-dialog, missing keys in keyviews and some problems with the selectionarea were fixed.
- it now stops recording and shows the pause menu if you focus the keyview or the selectionarea, those are always the ones compiz focuses first when I alt-tab into eidete to stop recording
- contractor prevents a useable save-dialog for me on oneiric, I am not sure why. I made a hack so it will show up regardless and let me save the file. It works although save-dialog complains. I am not sure if that should be merged, rather contractor should be fixed I guess.
- I added some missing key captions in keyview, and I changed keycapture.c so it uses XkbKeycodeToKeysym, which can lookup the correct Keysym according to shift state. So now shifted key names are shown correctly.
- the previous selectionarea had the problem that the area within the rectangle wasn't actually the area that was recorded, it recorded the area of the window including the handles. The handles prevented correct placement at the edges of the screen. I made a new selectionarea fixing those issues.
(sorry for proposing this twice)
Tom Beckmann (tombeckmann) : | # |
Preview Diff
1 | === modified file 'src/Widgets/end_dialog.vala' | |||
2 | --- src/Widgets/end_dialog.vala 2012-01-05 19:27:20 +0000 | |||
3 | +++ src/Widgets/end_dialog.vala 2012-03-27 11:57:47 +0000 | |||
4 | @@ -90,10 +90,12 @@ | |||
5 | 90 | t.get_cursor (out path, null); | 90 | t.get_cursor (out path, null); |
6 | 91 | try{ | 91 | try{ |
7 | 92 | Process.spawn_command_line_async (c[int.parse (path.to_string ())].lookup ("Exec")); | 92 | Process.spawn_command_line_async (c[int.parse (path.to_string ())].lookup ("Exec")); |
10 | 93 | }catch (Error e){error (e.message);} | 93 | }catch (Error e){ |
11 | 94 | Gtk.main_quit (); | 94 | print(e.message); |
12 | 95 | Gtk.main_quit (); | ||
13 | 96 | } | ||
14 | 95 | }); | 97 | }); |
16 | 96 | }else{ | 98 | } else { |
17 | 97 | export.clicked.connect ( () => { | 99 | export.clicked.connect ( () => { |
18 | 98 | var source = File.new_for_path (app.settings.destination); | 100 | var source = File.new_for_path (app.settings.destination); |
19 | 99 | var file = new FileChooserDialog (_("Save"), null, FileChooserAction.SAVE, Stock.OK, ResponseType.OK); | 101 | var file = new FileChooserDialog (_("Save"), null, FileChooserAction.SAVE, Stock.OK, ResponseType.OK); |
20 | 100 | 102 | ||
21 | === modified file 'src/Widgets/keyview.vala' | |||
22 | --- src/Widgets/keyview.vala 2012-03-23 14:54:41 +0000 | |||
23 | +++ src/Widgets/keyview.vala 2012-03-27 11:57:47 +0000 | |||
24 | @@ -11,14 +11,16 @@ | |||
25 | 11 | public bool shift; | 11 | public bool shift; |
26 | 12 | public bool alt; | 12 | public bool alt; |
27 | 13 | public bool super; | 13 | public bool super; |
28 | 14 | public bool iso_level3_shift; | ||
29 | 14 | public int count; | 15 | public int count; |
30 | 15 | 16 | ||
32 | 16 | public Key (string key, bool ctrl, bool shift, bool alt, bool super){ | 17 | public Key (string key, bool ctrl, bool shift, bool alt, bool super, bool iso_level3_shift){ |
33 | 17 | this.key = key; | 18 | this.key = key; |
34 | 18 | this.ctrl = ctrl; | 19 | this.ctrl = ctrl; |
35 | 19 | this.shift = shift; | 20 | this.shift = shift; |
36 | 20 | this.alt = alt; | 21 | this.alt = alt; |
37 | 21 | this.super = super; | 22 | this.super = super; |
38 | 23 | this.iso_level3_shift = iso_level3_shift; | ||
39 | 22 | this.count = 1; | 24 | this.count = 1; |
40 | 23 | } | 25 | } |
41 | 24 | } | 26 | } |
42 | @@ -35,6 +37,7 @@ | |||
43 | 35 | private bool shift; | 37 | private bool shift; |
44 | 36 | private bool alt; | 38 | private bool alt; |
45 | 37 | private bool super; | 39 | private bool super; |
46 | 40 | private bool iso_level3_shift; | ||
47 | 38 | 41 | ||
48 | 39 | private int screen_h; | 42 | private int screen_h; |
49 | 40 | 43 | ||
50 | @@ -57,9 +60,15 @@ | |||
51 | 57 | 60 | ||
52 | 58 | ctx.set_source_rgba (1.0, 1.0, 1.0, 1.0); | 61 | ctx.set_source_rgba (1.0, 1.0, 1.0, 1.0); |
53 | 59 | 62 | ||
55 | 60 | int [] sizes = {0, 30, 45, 50, 65}; | 63 | int [] sizes = {0, 30, 45, 55, 60}; |
56 | 61 | print ("%i\n", keys.peek_nth (i).key.length); | 64 | print ("%i\n", keys.peek_nth (i).key.length); |
58 | 62 | ctx.set_font_size (key_size- sizes[keys.peek_nth (i).key.length]); | 65 | |
59 | 66 | if( keys.peek_nth (i).key.length >= sizes.length ) { | ||
60 | 67 | ctx.set_font_size (key_size - sizes[sizes.length - 1]); | ||
61 | 68 | } else { | ||
62 | 69 | ctx.set_font_size (key_size - sizes[keys.peek_nth (i).key.length]); | ||
63 | 70 | } | ||
64 | 71 | |||
65 | 63 | ctx.move_to (key_size - 40, screen_h - (i+1)*key_size-20); | 72 | ctx.move_to (key_size - 40, screen_h - (i+1)*key_size-20); |
66 | 64 | ctx.show_text (keys.peek_nth (i).key); | 73 | ctx.show_text (keys.peek_nth (i).key); |
67 | 65 | 74 | ||
68 | @@ -70,21 +79,25 @@ | |||
69 | 70 | } | 79 | } |
70 | 71 | ctx.set_font_size (12); | 80 | ctx.set_font_size (12); |
71 | 72 | if (keys.peek_nth (i).super){ | 81 | if (keys.peek_nth (i).super){ |
73 | 73 | ctx.move_to (5, screen_h - (i+1)*key_size-50); | 82 | ctx.move_to (5, screen_h - (i+1)*key_size-52); |
74 | 74 | ctx.show_text ("Super"); | 83 | ctx.show_text ("Super"); |
75 | 75 | } | 84 | } |
76 | 76 | if (keys.peek_nth (i).ctrl){ | 85 | if (keys.peek_nth (i).ctrl){ |
78 | 77 | ctx.move_to (5, screen_h - (i+1)*key_size-35); | 86 | ctx.move_to (5, screen_h - (i+1)*key_size-37); |
79 | 78 | ctx.show_text ("Ctrl"); | 87 | ctx.show_text ("Ctrl"); |
80 | 79 | } | 88 | } |
81 | 80 | if (keys.peek_nth (i).shift){ | 89 | if (keys.peek_nth (i).shift){ |
83 | 81 | ctx.move_to (5, screen_h - (i+1)*key_size-20); | 90 | ctx.move_to (5, screen_h - (i+1)*key_size-22); |
84 | 82 | ctx.show_text ("Shift"); | 91 | ctx.show_text ("Shift"); |
85 | 83 | } | 92 | } |
86 | 84 | if (keys.peek_nth (i).alt){ | 93 | if (keys.peek_nth (i).alt){ |
88 | 85 | ctx.move_to (5, screen_h - (i+1)*key_size-5); | 94 | ctx.move_to (5, screen_h - (i+1)*key_size-7); |
89 | 86 | ctx.show_text ("Alt"); | 95 | ctx.show_text ("Alt"); |
90 | 87 | } | 96 | } |
91 | 97 | if (keys.peek_nth (i).iso_level3_shift){ | ||
92 | 98 | ctx.move_to (5, screen_h - (i+1)*key_size-12); | ||
93 | 99 | ctx.show_text ("AltGr"); | ||
94 | 100 | } | ||
95 | 88 | } | 101 | } |
96 | 89 | 102 | ||
97 | 90 | return base.draw (ctx); | 103 | return base.draw (ctx); |
98 | @@ -100,21 +113,31 @@ | |||
99 | 100 | public KeyView (){ | 113 | public KeyView (){ |
100 | 101 | this.key_size = 75; | 114 | this.key_size = 75; |
101 | 102 | this.fade_duration = 2000; | 115 | this.fade_duration = 2000; |
103 | 103 | 116 | ||
104 | 117 | this.stick (); | ||
105 | 104 | this.set_keep_above (true); | 118 | this.set_keep_above (true); |
108 | 105 | this.stick (); | 119 | this.deletable = false; |
109 | 106 | this.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN; | 120 | this.resizable = false; |
110 | 121 | this.set_has_resize_grip (false); | ||
111 | 107 | this.skip_pager_hint = true; | 122 | this.skip_pager_hint = true; |
112 | 108 | this.skip_taskbar_hint = true; | 123 | this.skip_taskbar_hint = true; |
113 | 124 | |||
114 | 125 | this.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN; | ||
115 | 126 | this.events = Gdk.EventMask.BUTTON_MOTION_MASK | Gdk.EventMask.BUTTON1_MOTION_MASK | | ||
116 | 127 | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK ; | ||
117 | 128 | |||
118 | 129 | this.realize(); | ||
119 | 109 | 130 | ||
121 | 110 | this.keys = new Queue<Key> (); | 131 | Cairo.RectangleInt rect = {0, 0, 1, 1}; |
122 | 132 | this.get_window ().input_shape_combine_region (new Cairo.Region.rectangle (rect), 0, 0); | ||
123 | 111 | 133 | ||
124 | 112 | this.enter_notify_event.connect ( () => { | 134 | this.enter_notify_event.connect ( () => { |
125 | 113 | Cairo.RectangleInt rect = {0, 0, 1, 1}; | ||
126 | 114 | this.get_window ().input_shape_combine_region (new Cairo.Region.rectangle (rect), 0, 0); | 135 | this.get_window ().input_shape_combine_region (new Cairo.Region.rectangle (rect), 0, 0); |
127 | 115 | return true; | 136 | return true; |
128 | 116 | }); | 137 | }); |
129 | 117 | 138 | ||
130 | 139 | this.keys = new Queue<Key> (); | ||
131 | 140 | |||
132 | 118 | //setup the key background | 141 | //setup the key background |
133 | 119 | key_bg = new Cairo.ImageSurface (Cairo.Format.ARGB32, key_size, key_size); | 142 | key_bg = new Cairo.ImageSurface (Cairo.Format.ARGB32, key_size, key_size); |
134 | 120 | var ctx = new Cairo.Context (key_bg); | 143 | var ctx = new Cairo.Context (key_bg); |
135 | @@ -155,6 +178,10 @@ | |||
136 | 155 | this.super = false; | 178 | this.super = false; |
137 | 156 | this.queue_draw (); | 179 | this.queue_draw (); |
138 | 157 | return; | 180 | return; |
139 | 181 | case "ISO_Level3_Shift": | ||
140 | 182 | this.iso_level3_shift = false; | ||
141 | 183 | this.queue_draw (); | ||
142 | 184 | return; | ||
143 | 158 | } | 185 | } |
144 | 159 | }else{ | 186 | }else{ |
145 | 160 | string res = keyvalue; | 187 | string res = keyvalue; |
146 | @@ -179,18 +206,28 @@ | |||
147 | 179 | this.super = true; | 206 | this.super = true; |
148 | 180 | this.queue_draw (); | 207 | this.queue_draw (); |
149 | 181 | return; | 208 | return; |
150 | 209 | case "ISO_Level3_Shift": | ||
151 | 210 | this.iso_level3_shift = true; | ||
152 | 211 | this.queue_draw (); | ||
153 | 212 | return; | ||
154 | 182 | case "Escape": | 213 | case "Escape": |
155 | 183 | res = "Esc"; break; | 214 | res = "Esc"; break; |
156 | 184 | case "Return": | 215 | case "Return": |
157 | 185 | res = "⏎"; break; | 216 | res = "⏎"; break; |
158 | 186 | case "Delete": | 217 | case "Delete": |
159 | 187 | res = "Del"; break; | 218 | res = "Del"; break; |
160 | 219 | case "Insert": | ||
161 | 220 | res = "Ins"; break; | ||
162 | 188 | case "comma": | 221 | case "comma": |
163 | 189 | res = ","; break; | 222 | res = ","; break; |
164 | 190 | case "period": | 223 | case "period": |
165 | 191 | res = "."; break; | 224 | res = "."; break; |
166 | 192 | case "minus": | 225 | case "minus": |
167 | 193 | res = "-"; break; | 226 | res = "-"; break; |
168 | 227 | case "plus": | ||
169 | 228 | res = "+"; break; | ||
170 | 229 | case "Tab": | ||
171 | 230 | res = "Tab"; break; | ||
172 | 194 | case "BackSpace": | 231 | case "BackSpace": |
173 | 195 | res = "⌫"; break; | 232 | res = "⌫"; break; |
174 | 196 | case "Left": | 233 | case "Left": |
175 | @@ -203,6 +240,64 @@ | |||
176 | 203 | res = "▼"; break; | 240 | res = "▼"; break; |
177 | 204 | case "space": | 241 | case "space": |
178 | 205 | res = " "; break; | 242 | res = " "; break; |
179 | 243 | case "backslash": | ||
180 | 244 | res = "\\"; break; | ||
181 | 245 | case "bracketleft": | ||
182 | 246 | res = "["; break; | ||
183 | 247 | case "bracketright": | ||
184 | 248 | res = "]"; break; | ||
185 | 249 | case "braceleft": | ||
186 | 250 | res = "{"; break; | ||
187 | 251 | case "braceright": | ||
188 | 252 | res = "}"; break; | ||
189 | 253 | case "apostrophe": | ||
190 | 254 | res = "'"; break; | ||
191 | 255 | case "asciitilde": | ||
192 | 256 | res = "~"; break; | ||
193 | 257 | case "grave": | ||
194 | 258 | res = "`"; break; | ||
195 | 259 | case "bar": | ||
196 | 260 | res = "|"; break; | ||
197 | 261 | case "ampersand": | ||
198 | 262 | res = "&"; break; | ||
199 | 263 | case "parenleft": | ||
200 | 264 | res = "("; break; | ||
201 | 265 | case "parenright": | ||
202 | 266 | res = ")"; break; | ||
203 | 267 | case "less": | ||
204 | 268 | res = "<"; break; | ||
205 | 269 | case "greater": | ||
206 | 270 | res = ">"; break; | ||
207 | 271 | case "equal": | ||
208 | 272 | res = "="; break; | ||
209 | 273 | case "exclam": | ||
210 | 274 | res = "!"; break; | ||
211 | 275 | case "quotedbl": | ||
212 | 276 | res = "\""; break; | ||
213 | 277 | case "numbersign": | ||
214 | 278 | res = "\""; break; | ||
215 | 279 | case "dollar": | ||
216 | 280 | res = "$"; break; | ||
217 | 281 | case "slash": | ||
218 | 282 | res = "/"; break; | ||
219 | 283 | case "asterisk": | ||
220 | 284 | res = "*"; break; | ||
221 | 285 | case "colon": | ||
222 | 286 | res = ":"; break; | ||
223 | 287 | case "semicolon": | ||
224 | 288 | res = ";"; break; | ||
225 | 289 | case "underscore": | ||
226 | 290 | res = "_"; break; | ||
227 | 291 | case "Next": | ||
228 | 292 | res = "Pg▲"; break; | ||
229 | 293 | case "Prior": | ||
230 | 294 | res = "Pg▼"; break; | ||
231 | 295 | case "asciicircum": | ||
232 | 296 | res = "^"; break; | ||
233 | 297 | case "at": | ||
234 | 298 | res = "@"; break; | ||
235 | 299 | case "question": | ||
236 | 300 | res = "?"; break; | ||
237 | 206 | default: | 301 | default: |
238 | 207 | if (keyvalue.length > 9) | 302 | if (keyvalue.length > 9) |
239 | 208 | res = keyvalue.substring (0, 9); | 303 | res = keyvalue.substring (0, 9); |
240 | @@ -212,12 +307,13 @@ | |||
241 | 212 | if ((!keys.is_empty ()) && | 307 | if ((!keys.is_empty ()) && |
242 | 213 | (keys.peek_head ().key == res) && | 308 | (keys.peek_head ().key == res) && |
243 | 214 | (keys.peek_head ().ctrl == ctrl) && | 309 | (keys.peek_head ().ctrl == ctrl) && |
246 | 215 | (keys.peek_head ().shift == shift) && | 310 | (keys.peek_head ().shift == shift) && |
247 | 216 | (keys.peek_head ().alt == alt)){ | 311 | (keys.peek_head ().alt == alt) && |
248 | 312 | (keys.peek_head ().iso_level3_shift == iso_level3_shift)){ | ||
249 | 217 | keys.peek_head ().count ++; | 313 | keys.peek_head ().count ++; |
250 | 218 | this.queue_draw (); | 314 | this.queue_draw (); |
251 | 219 | }else{ | 315 | }else{ |
253 | 220 | var key = new Key (res, ctrl, shift, alt, super); | 316 | var key = new Key (res, ctrl, shift, alt, super, iso_level3_shift); |
254 | 221 | if (!released){ | 317 | if (!released){ |
255 | 222 | keys.push_head (key); | 318 | keys.push_head (key); |
256 | 223 | if (keys.length+2 > (screen_h / key_size)) | 319 | if (keys.length+2 > (screen_h / key_size)) |
257 | 224 | 320 | ||
258 | === modified file 'src/Widgets/selectionarea.vala' | |||
259 | --- src/Widgets/selectionarea.vala 2012-03-23 15:01:29 +0000 | |||
260 | +++ src/Widgets/selectionarea.vala 2012-03-27 11:57:47 +0000 | |||
261 | @@ -94,24 +94,28 @@ | |||
262 | 94 | public override bool draw (Cairo.Context ctx){ | 94 | public override bool draw (Cairo.Context ctx){ |
263 | 95 | int w = this.get_allocated_width (); | 95 | int w = this.get_allocated_width (); |
264 | 96 | int h = this.get_allocated_height (); | 96 | int h = this.get_allocated_height (); |
266 | 97 | int r = 12; | 97 | int r = 16; |
267 | 98 | if (!discrete){ | 98 | if (!discrete){ |
269 | 99 | pos = {{r,r},{w/2,r},{w-r,r},{w-r,h/2},{w-r,h-r},{w/2,h-r},{r,h-r},{r,h/2}}; | 99 | pos = {{1, 1}, // upper left |
270 | 100 | {w/2, 1}, // upper midpoint | ||
271 | 101 | {w-1, 1}, // upper right | ||
272 | 102 | {w-1, h/2}, // right midpoint | ||
273 | 103 | {w-1, h-1}, // lower right | ||
274 | 104 | {w/2, h-1}, // lower midpoint | ||
275 | 105 | {1, h-1}, // lower left | ||
276 | 106 | {1, h/2}}; // left midpoint | ||
277 | 107 | |||
278 | 100 | 108 | ||
280 | 101 | ctx.rectangle (r+1, r, w-2*r, h-2*r); | 109 | ctx.rectangle (0, 0, w, h); |
281 | 102 | ctx.set_source_rgba (0.1, 0.1, 0.1, 0.2); | 110 | ctx.set_source_rgba (0.1, 0.1, 0.1, 0.2); |
282 | 103 | ctx.fill (); | 111 | ctx.fill (); |
283 | 104 | 112 | ||
284 | 105 | for (var i=0;i<8;i++){ | 113 | for (var i=0;i<8;i++){ |
287 | 106 | ctx.arc (pos[i,0], pos[i,1], r, 0.0, 2 * 3.14); | 114 | ctx.arc (pos[i,0], pos[i,1], r, 0.0, 2*3.14); |
288 | 107 | ctx.set_source_rgb (1.0, 1.0, 1.0); | 115 | ctx.set_source_rgb (0.7, 0.7, 0.7); |
289 | 108 | ctx.fill (); | 116 | ctx.fill (); |
290 | 109 | ctx.arc (pos[i,0], pos[i,1], r+1, 0.0, 2 * 3.14); | ||
291 | 110 | ctx.set_line_width (1.0); | ||
292 | 111 | ctx.set_source_rgba (0.0, 0.0, 0.0, 0.3); | ||
293 | 112 | ctx.stroke (); | ||
294 | 113 | } | 117 | } |
296 | 114 | ctx.rectangle (r, r, w-2*r, h-2*r); | 118 | ctx.rectangle (0, 0, w, h); |
297 | 115 | ctx.set_source_rgb (1.0, 1.0, 1.0); | 119 | ctx.set_source_rgb (1.0, 1.0, 1.0); |
298 | 116 | ctx.set_line_width (1.0); | 120 | ctx.set_line_width (1.0); |
299 | 117 | ctx.stroke (); | 121 | ctx.stroke (); |
300 | @@ -135,7 +139,7 @@ | |||
301 | 135 | this.set_keep_above (true); | 139 | this.set_keep_above (true); |
302 | 136 | this.queue_draw (); | 140 | this.queue_draw (); |
303 | 137 | this.resize (w+6, h+6); | 141 | this.resize (w+6, h+6); |
305 | 138 | this.move (x, y-1); | 142 | this.move (x-2, y-2); |
306 | 139 | this.deletable = false; | 143 | this.deletable = false; |
307 | 140 | 144 | ||
308 | 141 | this.realize (); | 145 | this.realize (); |
309 | @@ -147,7 +151,6 @@ | |||
310 | 147 | this.get_window ().input_shape_combine_region (new Cairo.Region.rectangle (rect), 0, 0); | 151 | this.get_window ().input_shape_combine_region (new Cairo.Region.rectangle (rect), 0, 0); |
311 | 148 | return true; | 152 | return true; |
312 | 149 | }); | 153 | }); |
313 | 150 | |||
314 | 151 | } | 154 | } |
315 | 152 | } | 155 | } |
316 | 153 | } | 156 | } |
317 | 154 | 157 | ||
318 | === modified file 'src/eidete.vala' | |||
319 | --- src/eidete.vala 2012-03-23 14:57:45 +0000 | |||
320 | +++ src/eidete.vala 2012-03-27 11:57:47 +0000 | |||
321 | @@ -37,10 +37,9 @@ | |||
322 | 37 | public int sy; | 37 | public int sy; |
323 | 38 | public int ex; | 38 | public int ex; |
324 | 39 | public int ey; | 39 | public int ey; |
326 | 40 | public int screen; | 40 | public int monitor; |
327 | 41 | public bool audio; | 41 | public bool audio; |
328 | 42 | public bool keyview; | 42 | public bool keyview; |
329 | 43 | public bool limits; | ||
330 | 44 | public string destination; | 43 | public string destination; |
331 | 45 | } | 44 | } |
332 | 46 | 45 | ||
333 | @@ -83,12 +82,14 @@ | |||
334 | 83 | public Grid pause_grid; | 82 | public Grid pause_grid; |
335 | 84 | public Image pause_icon; | 83 | public Image pause_icon; |
336 | 85 | public Wnck.Window win; | 84 | public Wnck.Window win; |
337 | 85 | public Gdk.Screen screen; | ||
338 | 86 | public Gdk.Rectangle monitor_rec; | ||
339 | 86 | 87 | ||
340 | 87 | public Settings settings; | 88 | public Settings settings; |
341 | 88 | 89 | ||
342 | 89 | public bool recording; | 90 | public bool recording; |
343 | 90 | public bool typing_size; | 91 | public bool typing_size; |
345 | 91 | 92 | ||
346 | 92 | public EideteApp (){ | 93 | public EideteApp (){ |
347 | 93 | } | 94 | } |
348 | 94 | 95 | ||
349 | @@ -226,16 +227,25 @@ | |||
350 | 226 | about_bt.clicked.connect ( () => { | 227 | about_bt.clicked.connect ( () => { |
351 | 227 | this.show_about (this.main_window); | 228 | this.show_about (this.main_window); |
352 | 228 | }); | 229 | }); |
355 | 229 | 230 | ||
356 | 230 | settings.screen = 0; | 231 | this.screen = Gdk.Screen.get_default(); |
357 | 232 | settings.monitor = 0; | ||
358 | 231 | monitors_combo.changed.connect ( () => { | 233 | monitors_combo.changed.connect ( () => { |
360 | 232 | settings.screen = int.parse (monitors_combo.active_id); | 234 | settings.monitor = int.parse (monitors_combo.active_id); |
361 | 235 | this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec); | ||
362 | 236 | settings.sx = this.monitor_rec.x; | ||
363 | 237 | settings.sy = this.monitor_rec.y; | ||
364 | 238 | settings.ex = settings.sx + this.monitor_rec.width - 1; | ||
365 | 239 | settings.ey = settings.sy + this.monitor_rec.height - 1; | ||
366 | 233 | }); | 240 | }); |
367 | 234 | 241 | ||
372 | 235 | settings.sx = 0; | 242 | settings.monitor = int.parse (monitors_combo.active_id); |
373 | 236 | settings.sy = 0; | 243 | this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec); |
374 | 237 | settings.ex = 0; | 244 | settings.sx = this.monitor_rec.x; |
375 | 238 | settings.ey = 0; | 245 | settings.sy = this.monitor_rec.y; |
376 | 246 | settings.ex = settings.sx + this.monitor_rec.width - 1; | ||
377 | 247 | settings.ey = settings.sy + this.monitor_rec.height - 1; | ||
378 | 248 | |||
379 | 239 | recordingarea_combo.changed.connect ( () => { | 249 | recordingarea_combo.changed.connect ( () => { |
380 | 240 | if (recordingarea_combo.active_id != "full"){ | 250 | if (recordingarea_combo.active_id != "full"){ |
381 | 241 | selectionarea = new Eidete.Widgets.SelectionArea (); | 251 | selectionarea = new Eidete.Widgets.SelectionArea (); |
382 | @@ -248,18 +258,25 @@ | |||
383 | 248 | height.value = (int)h; | 258 | height.value = (int)h; |
384 | 249 | settings.sx = x; | 259 | settings.sx = x; |
385 | 250 | settings.sy = y; | 260 | settings.sy = y; |
390 | 251 | settings.ex = settings.sx+w; | 261 | settings.ex = settings.sx+w-1; |
391 | 252 | settings.ey = settings.sy+h; | 262 | settings.ey = settings.sy+h-1; |
392 | 253 | settings.limits = true; | 263 | } |
393 | 254 | } | 264 | }); |
394 | 265 | selectionarea.focus_in_event.connect( (ev) => { | ||
395 | 266 | if (this.recording){ | ||
396 | 267 | this.main_window.deiconify(); | ||
397 | 268 | this.main_window.present(); | ||
398 | 269 | } | ||
399 | 270 | return false; | ||
400 | 255 | }); | 271 | }); |
401 | 256 | }else{ | 272 | }else{ |
402 | 257 | selectionarea.destroy (); | 273 | selectionarea.destroy (); |
408 | 258 | settings.sx = 0; | 274 | settings.monitor = int.parse (monitors_combo.active_id); |
409 | 259 | settings.sy = 0; | 275 | this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec); |
410 | 260 | settings.ex = 0; | 276 | settings.sx = this.monitor_rec.x; |
411 | 261 | settings.ey = 0; | 277 | settings.sy = this.monitor_rec.y; |
412 | 262 | settings.limits = false; | 278 | settings.ex = settings.sx + this.monitor_rec.width - 1; |
413 | 279 | settings.ey = settings.sy + this.monitor_rec.height - 1; | ||
414 | 263 | width.set_sensitive (false); | 280 | width.set_sensitive (false); |
415 | 264 | height.set_sensitive (false); | 281 | height.set_sensitive (false); |
416 | 265 | } | 282 | } |
417 | @@ -303,29 +320,40 @@ | |||
418 | 303 | 320 | ||
419 | 304 | settings.destination = GLib.Environment.get_tmp_dir ()+ | 321 | settings.destination = GLib.Environment.get_tmp_dir ()+ |
420 | 305 | "/screencast"+new GLib.DateTime.now_local ().to_unix ().to_string ()+".webm"; | 322 | "/screencast"+new GLib.DateTime.now_local ().to_unix ().to_string ()+".webm"; |
441 | 306 | 323 | ||
442 | 307 | 324 | // ulong handle = 0; | |
443 | 308 | ulong handle = 0; | 325 | // handle = Wnck.Screen.get_default().active_window_changed.connect ( () => { |
444 | 309 | handle = Wnck.Screen.get_default ().active_window_changed.connect ( () => { | 326 | // this.win = Wnck.Screen.get_default().get_active_window (); |
445 | 310 | this.win = Wnck.Screen.get_default ().get_active_window (); | 327 | // print("setting active window\n"); |
446 | 311 | this.win.state_changed.connect ( (changed_s, new_s) => { | 328 | // this.win.state_changed.connect ( (changed_s, new_s) => { |
447 | 312 | if (recording && (new_s == 0)){ | 329 | // print("active window changed\n"); |
448 | 313 | pipeline.set_state (State.PAUSED); | 330 | // if (recording && (new_s == 0)){ |
449 | 314 | this.recording = false; | 331 | // pipeline.set_state (State.PAUSED); |
450 | 315 | switch_to_paused (true); | 332 | // this.recording = false; |
451 | 316 | } | 333 | // switch_to_paused (true); |
452 | 317 | }); | 334 | // } |
453 | 318 | Wnck.Screen.get_default ().disconnect (handle); | 335 | // }); |
454 | 319 | }); | 336 | // Wnck.Screen.get_default ().disconnect (handle); |
455 | 320 | 337 | // }); | |
456 | 321 | 338 | ||
457 | 322 | this.main_window.focus_in_event.connect ( (ev) => { | 339 | // this.main_window.focus_in_event.connect ( (ev) => { |
458 | 323 | if (this.selectionarea != null && !this.selectionarea.not_visible){ | 340 | // if (this.selectionarea != null && !this.selectionarea.not_visible){ |
459 | 324 | //this.selectionarea.present (); | 341 | // //this.selectionarea.present (); |
460 | 325 | //this.main_window.present (); | 342 | // //this.main_window.present (); |
461 | 343 | // } | ||
462 | 344 | // return false; | ||
463 | 345 | // }); | ||
464 | 346 | |||
465 | 347 | this.main_window.visibility_notify_event.connect ( (ev) => { | ||
466 | 348 | if (this.recording && ev.state == 0){ | ||
467 | 349 | print("pausing recording\n"); | ||
468 | 350 | pipeline.set_state (State.PAUSED); | ||
469 | 351 | this.recording = false; | ||
470 | 352 | switch_to_paused (true); | ||
471 | 326 | } | 353 | } |
472 | 327 | return false; | 354 | return false; |
473 | 328 | }); | 355 | }); |
474 | 356 | |||
475 | 329 | 357 | ||
476 | 330 | this.main_window.destroy.connect ( () => { | 358 | this.main_window.destroy.connect ( () => { |
477 | 331 | if (pipeline != null) | 359 | if (pipeline != null) |
478 | @@ -345,7 +373,7 @@ | |||
479 | 345 | } | 373 | } |
480 | 346 | } | 374 | } |
481 | 347 | 375 | ||
483 | 348 | private void buid_pause_ui (){ | 376 | private void build_pause_ui (){ |
484 | 349 | pause_grid = new Grid (); | 377 | pause_grid = new Grid (); |
485 | 350 | pause_grid.margin = 12; | 378 | pause_grid.margin = 12; |
486 | 351 | 379 | ||
487 | @@ -380,7 +408,9 @@ | |||
488 | 380 | /* | 408 | /* |
489 | 381 | Events | 409 | Events |
490 | 382 | */ | 410 | */ |
492 | 383 | cancel_bt.clicked.connect ( () => {this.main_window.destroy ();}); | 411 | cancel_bt.clicked.connect ( () => { |
493 | 412 | this.main_window.destroy (); | ||
494 | 413 | }); | ||
495 | 384 | 414 | ||
496 | 385 | stop_bt.clicked.connect ( () => { | 415 | stop_bt.clicked.connect ( () => { |
497 | 386 | var end = new Eidete.Widgets.EndDialog (this); | 416 | var end = new Eidete.Widgets.EndDialog (this); |
498 | @@ -390,25 +420,25 @@ | |||
499 | 390 | 420 | ||
500 | 391 | continue_bt.clicked.connect ( () => { | 421 | continue_bt.clicked.connect ( () => { |
501 | 392 | this.main_window.iconify (); | 422 | this.main_window.iconify (); |
502 | 423 | this.pipeline.set_state (State.PLAYING); | ||
503 | 393 | this.recording = true; | 424 | this.recording = true; |
504 | 394 | this.pipeline.set_state (State.PLAYING); | ||
505 | 395 | switch_to_paused (false); | 425 | switch_to_paused (false); |
506 | 396 | }); | 426 | }); |
507 | 397 | } | 427 | } |
508 | 398 | 428 | ||
509 | 399 | public void record (){ | 429 | public void record (){ |
510 | 400 | this.recording = true; | ||
511 | 401 | |||
512 | 402 | if (settings.keyview){ | 430 | if (settings.keyview){ |
513 | 403 | keyview = new Eidete.Widgets.KeyView (); | 431 | keyview = new Eidete.Widgets.KeyView (); |
522 | 404 | if (settings.limits) | 432 | keyview.focus_in_event.connect((ev) => { |
523 | 405 | keyview.place (selectionarea.x+selectionarea.w, | 433 | if (this.recording){ |
524 | 406 | selectionarea.y, | 434 | this.main_window.deiconify(); |
525 | 407 | selectionarea.h); | 435 | this.main_window.present(); |
526 | 408 | else | 436 | } |
527 | 409 | keyview.place (Gdk.Screen.get_default ().get_width (), | 437 | return false; |
528 | 410 | 0, | 438 | }); |
529 | 411 | Gdk.Screen.get_default ().get_height ()); | 439 | keyview.place (settings.ex, |
530 | 440 | settings.sy, | ||
531 | 441 | settings.ey - settings.sy); | ||
532 | 412 | keyview.show_all (); | 442 | keyview.show_all (); |
533 | 413 | } | 443 | } |
534 | 414 | 444 | ||
535 | @@ -439,12 +469,12 @@ | |||
536 | 439 | 469 | ||
537 | 440 | //configure | 470 | //configure |
538 | 441 | sink.set ("location", settings.destination); | 471 | sink.set ("location", settings.destination); |
542 | 442 | videobin.get_by_name ("videosrc").set ("startx", this.settings.sx+2); | 472 | videobin.get_by_name ("videosrc").set ("startx", this.settings.sx); |
543 | 443 | videobin.get_by_name ("videosrc").set ("starty", this.settings.sy+1); | 473 | videobin.get_by_name ("videosrc").set ("starty", this.settings.sy); |
544 | 444 | videobin.get_by_name ("videosrc").set ("endx", this.settings.ex+1); | 474 | videobin.get_by_name ("videosrc").set ("endx", this.settings.ex); |
545 | 445 | videobin.get_by_name ("videosrc").set ("endy", this.settings.ey); | 475 | videobin.get_by_name ("videosrc").set ("endy", this.settings.ey); |
546 | 446 | videobin.get_by_name ("videosrc").set ("use-damage", false); | 476 | videobin.get_by_name ("videosrc").set ("use-damage", false); |
548 | 447 | videobin.get_by_name ("videosrc").set ("screen-num", this.settings.screen); | 477 | videobin.get_by_name ("videosrc").set ("screen-num", this.settings.monitor); |
549 | 448 | 478 | ||
550 | 449 | //videobin.get_by_name ("encoder").set ("mode", 1); | 479 | //videobin.get_by_name ("encoder").set ("mode", 1); |
551 | 450 | videobin.get_by_name ("encoder").set ("quality", 10.0); | 480 | videobin.get_by_name ("encoder").set ("quality", 10.0); |
552 | @@ -477,6 +507,7 @@ | |||
553 | 477 | selectionarea.to_discrete (); | 507 | selectionarea.to_discrete (); |
554 | 478 | 508 | ||
555 | 479 | pipeline.set_state (State.PLAYING); | 509 | pipeline.set_state (State.PLAYING); |
556 | 510 | this.recording = true; | ||
557 | 480 | } | 511 | } |
558 | 481 | 512 | ||
559 | 482 | private bool bus_message_cb (Gst.Bus bus, Message msg){ | 513 | private bool bus_message_cb (Gst.Bus bus, Message msg){ |
560 | @@ -503,7 +534,7 @@ | |||
561 | 503 | this.main_window.title = _("Recording paused"); | 534 | this.main_window.title = _("Recording paused"); |
562 | 504 | this.main_window.remove (pause_icon); | 535 | this.main_window.remove (pause_icon); |
563 | 505 | if (pause_grid == null) | 536 | if (pause_grid == null) |
565 | 506 | this.buid_pause_ui (); | 537 | this.build_pause_ui (); |
566 | 507 | this.main_window.add (pause_grid); | 538 | this.main_window.add (pause_grid); |
567 | 508 | this.main_window.icon_name = "eidete"; | 539 | this.main_window.icon_name = "eidete"; |
568 | 509 | this.app_icon = "eidete"; | 540 | this.app_icon = "eidete"; |
569 | 510 | 541 | ||
570 | === modified file 'src/keycapture.c' | |||
571 | --- src/keycapture.c 2012-01-02 22:50:13 +0000 | |||
572 | +++ src/keycapture.c 2012-03-27 11:57:47 +0000 | |||
573 | @@ -2,6 +2,7 @@ | |||
574 | 2 | #include <glib.h> | 2 | #include <glib.h> |
575 | 3 | #include <X11/Xproto.h> | 3 | #include <X11/Xproto.h> |
576 | 4 | #include <X11/Xlib.h> | 4 | #include <X11/Xlib.h> |
577 | 5 | #include <X11/XKBlib.h> | ||
578 | 5 | #include <X11/extensions/record.h> //libxtst-dev, Xtst | 6 | #include <X11/extensions/record.h> //libxtst-dev, Xtst |
579 | 6 | #include <gstreamer-0.10/gst/gst.h> | 7 | #include <gstreamer-0.10/gst/gst.h> |
580 | 7 | #include <gstreamer-0.10/gst/gstinterface.h> | 8 | #include <gstreamer-0.10/gst/gstinterface.h> |
581 | @@ -18,13 +19,22 @@ | |||
582 | 18 | 19 | ||
583 | 19 | void key_pressed_cb(XPointer arg, XRecordInterceptData *d) { | 20 | void key_pressed_cb(XPointer arg, XRecordInterceptData *d) { |
584 | 20 | if (d->category != XRecordFromServer) return; | 21 | if (d->category != XRecordFromServer) return; |
585 | 22 | |||
586 | 23 | xEvent* event = (xEvent*)d->data; | ||
587 | 24 | |||
588 | 21 | unsigned char type = ((unsigned char*)d->data)[0] & 0x7F; | 25 | unsigned char type = ((unsigned char*)d->data)[0] & 0x7F; |
589 | 22 | unsigned char detail = ((unsigned char*)d->data)[1]; | 26 | unsigned char detail = ((unsigned char*)d->data)[1]; |
590 | 27 | unsigned int shiftlevel = 0; | ||
591 | 28 | |||
592 | 29 | if( event->u.keyButtonPointer.state == 0 || | ||
593 | 30 | event->u.keyButtonPointer.state == 1 ) { | ||
594 | 31 | shiftlevel = event->u.keyButtonPointer.state; | ||
595 | 32 | } | ||
596 | 23 | 33 | ||
597 | 24 | if (type == KeyPress) { | 34 | if (type == KeyPress) { |
599 | 25 | g_signal_emit_by_name (arg, "captured", XKeysymToString (XKeycodeToKeysym (dpy, detail, 0)), FALSE); | 35 | g_signal_emit_by_name (arg, "captured", XKeysymToString (XkbKeycodeToKeysym (dpy, detail, 0, shiftlevel)), FALSE); |
600 | 26 | }else if (type == KeyRelease){ | 36 | }else if (type == KeyRelease){ |
602 | 27 | g_signal_emit_by_name (arg, "captured", XKeysymToString (XKeycodeToKeysym (dpy, detail, 0)), TRUE); | 37 | g_signal_emit_by_name (arg, "captured", XKeysymToString (XkbKeycodeToKeysym (dpy, detail, 0, shiftlevel)), TRUE); |
603 | 28 | } | 38 | } |
604 | 29 | } | 39 | } |
605 | 30 | 40 | ||
606 | @@ -33,7 +43,7 @@ | |||
607 | 33 | XRecordRange* rr; | 43 | XRecordRange* rr; |
608 | 34 | dpy = XOpenDisplay (0); | 44 | dpy = XOpenDisplay (0); |
609 | 35 | 45 | ||
611 | 36 | XKeysymToString (XKeycodeToKeysym (dpy, 11, 1)); | 46 | XKeysymToString (XkbKeycodeToKeysym (dpy, 11, 1, 0)); |
612 | 37 | 47 | ||
613 | 38 | if (!(rr = XRecordAllocRange())) { | 48 | if (!(rr = XRecordAllocRange())) { |
614 | 39 | fprintf(stderr, "XRecordAllocRange error\n"); | 49 | fprintf(stderr, "XRecordAllocRange error\n"); |