Merge lp:~rakete/eidete/scratching-my-itches into lp:eidete

Proposed by Andreas Raster
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
Reviewer Review Type Date Requested Status
Tom Beckmann (community) Approve
Review via email: mp+99500@code.launchpad.net

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)

To post a comment you must log in.
Revision history for this message
Tom Beckmann (tombeckmann) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Widgets/end_dialog.vala'
--- src/Widgets/end_dialog.vala 2012-01-05 19:27:20 +0000
+++ src/Widgets/end_dialog.vala 2012-03-27 11:57:47 +0000
@@ -90,10 +90,12 @@
90 t.get_cursor (out path, null);90 t.get_cursor (out path, null);
91 try{91 try{
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"));
93 }catch (Error e){error (e.message);}93 }catch (Error e){
94 Gtk.main_quit ();94 print(e.message);
95 Gtk.main_quit ();
96 }
95 });97 });
96 }else{98 } else {
97 export.clicked.connect ( () => {99 export.clicked.connect ( () => {
98 var source = File.new_for_path (app.settings.destination);100 var source = File.new_for_path (app.settings.destination);
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);
100102
=== modified file 'src/Widgets/keyview.vala'
--- src/Widgets/keyview.vala 2012-03-23 14:54:41 +0000
+++ src/Widgets/keyview.vala 2012-03-27 11:57:47 +0000
@@ -11,14 +11,16 @@
11 public bool shift;11 public bool shift;
12 public bool alt;12 public bool alt;
13 public bool super;13 public bool super;
14 public bool iso_level3_shift;
14 public int count;15 public int count;
15 16
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){
17 this.key = key;18 this.key = key;
18 this.ctrl = ctrl;19 this.ctrl = ctrl;
19 this.shift = shift;20 this.shift = shift;
20 this.alt = alt;21 this.alt = alt;
21 this.super = super;22 this.super = super;
23 this.iso_level3_shift = iso_level3_shift;
22 this.count = 1;24 this.count = 1;
23 }25 }
24 }26 }
@@ -35,6 +37,7 @@
35 private bool shift;37 private bool shift;
36 private bool alt;38 private bool alt;
37 private bool super;39 private bool super;
40 private bool iso_level3_shift;
38 41
39 private int screen_h;42 private int screen_h;
40 43
@@ -57,9 +60,15 @@
57 60
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);
59 62
60 int [] sizes = {0, 30, 45, 50, 65};63 int [] sizes = {0, 30, 45, 55, 60};
61 print ("%i\n", keys.peek_nth (i).key.length);64 print ("%i\n", keys.peek_nth (i).key.length);
62 ctx.set_font_size (key_size- sizes[keys.peek_nth (i).key.length]);65
66 if( keys.peek_nth (i).key.length >= sizes.length ) {
67 ctx.set_font_size (key_size - sizes[sizes.length - 1]);
68 } else {
69 ctx.set_font_size (key_size - sizes[keys.peek_nth (i).key.length]);
70 }
71
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);
64 ctx.show_text (keys.peek_nth (i).key);73 ctx.show_text (keys.peek_nth (i).key);
65 74
@@ -70,21 +79,25 @@
70 }79 }
71 ctx.set_font_size (12);80 ctx.set_font_size (12);
72 if (keys.peek_nth (i).super){81 if (keys.peek_nth (i).super){
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 ctx.show_text ("Super");83 ctx.show_text ("Super");
75 }84 }
76 if (keys.peek_nth (i).ctrl){85 if (keys.peek_nth (i).ctrl){
77 ctx.move_to (5, screen_h - (i+1)*key_size-35);86 ctx.move_to (5, screen_h - (i+1)*key_size-37);
78 ctx.show_text ("Ctrl");87 ctx.show_text ("Ctrl");
79 }88 }
80 if (keys.peek_nth (i).shift){89 if (keys.peek_nth (i).shift){
81 ctx.move_to (5, screen_h - (i+1)*key_size-20);90 ctx.move_to (5, screen_h - (i+1)*key_size-22);
82 ctx.show_text ("Shift");91 ctx.show_text ("Shift");
83 }92 }
84 if (keys.peek_nth (i).alt){93 if (keys.peek_nth (i).alt){
85 ctx.move_to (5, screen_h - (i+1)*key_size-5);94 ctx.move_to (5, screen_h - (i+1)*key_size-7);
86 ctx.show_text ("Alt");95 ctx.show_text ("Alt");
87 }96 }
97 if (keys.peek_nth (i).iso_level3_shift){
98 ctx.move_to (5, screen_h - (i+1)*key_size-12);
99 ctx.show_text ("AltGr");
100 }
88 }101 }
89 102
90 return base.draw (ctx);103 return base.draw (ctx);
@@ -100,21 +113,31 @@
100 public KeyView (){113 public KeyView (){
101 this.key_size = 75;114 this.key_size = 75;
102 this.fade_duration = 2000;115 this.fade_duration = 2000;
103 116
117 this.stick ();
104 this.set_keep_above (true);118 this.set_keep_above (true);
105 this.stick ();119 this.deletable = false;
106 this.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN;120 this.resizable = false;
121 this.set_has_resize_grip (false);
107 this.skip_pager_hint = true;122 this.skip_pager_hint = true;
108 this.skip_taskbar_hint = true;123 this.skip_taskbar_hint = true;
124
125 this.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN;
126 this.events = Gdk.EventMask.BUTTON_MOTION_MASK | Gdk.EventMask.BUTTON1_MOTION_MASK |
127 Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK ;
128
129 this.realize();
109 130
110 this.keys = new Queue<Key> ();131 Cairo.RectangleInt rect = {0, 0, 1, 1};
132 this.get_window ().input_shape_combine_region (new Cairo.Region.rectangle (rect), 0, 0);
111 133
112 this.enter_notify_event.connect ( () => {134 this.enter_notify_event.connect ( () => {
113 Cairo.RectangleInt rect = {0, 0, 1, 1};
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);
115 return true;136 return true;
116 });137 });
117 138
139 this.keys = new Queue<Key> ();
140
118 //setup the key background141 //setup the key background
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);
120 var ctx = new Cairo.Context (key_bg);143 var ctx = new Cairo.Context (key_bg);
@@ -155,6 +178,10 @@
155 this.super = false;178 this.super = false;
156 this.queue_draw ();179 this.queue_draw ();
157 return;180 return;
181 case "ISO_Level3_Shift":
182 this.iso_level3_shift = false;
183 this.queue_draw ();
184 return;
158 }185 }
159 }else{186 }else{
160 string res = keyvalue;187 string res = keyvalue;
@@ -179,18 +206,28 @@
179 this.super = true;206 this.super = true;
180 this.queue_draw ();207 this.queue_draw ();
181 return;208 return;
209 case "ISO_Level3_Shift":
210 this.iso_level3_shift = true;
211 this.queue_draw ();
212 return;
182 case "Escape":213 case "Escape":
183 res = "Esc"; break;214 res = "Esc"; break;
184 case "Return":215 case "Return":
185 res = "⏎"; break;216 res = "⏎"; break;
186 case "Delete":217 case "Delete":
187 res = "Del"; break;218 res = "Del"; break;
219 case "Insert":
220 res = "Ins"; break;
188 case "comma":221 case "comma":
189 res = ","; break;222 res = ","; break;
190 case "period":223 case "period":
191 res = "."; break;224 res = "."; break;
192 case "minus":225 case "minus":
193 res = "-"; break;226 res = "-"; break;
227 case "plus":
228 res = "+"; break;
229 case "Tab":
230 res = "Tab"; break;
194 case "BackSpace":231 case "BackSpace":
195 res = "⌫"; break;232 res = "⌫"; break;
196 case "Left":233 case "Left":
@@ -203,6 +240,64 @@
203 res = "▼"; break;240 res = "▼"; break;
204 case "space":241 case "space":
205 res = " "; break;242 res = " "; break;
243 case "backslash":
244 res = "\\"; break;
245 case "bracketleft":
246 res = "["; break;
247 case "bracketright":
248 res = "]"; break;
249 case "braceleft":
250 res = "{"; break;
251 case "braceright":
252 res = "}"; break;
253 case "apostrophe":
254 res = "'"; break;
255 case "asciitilde":
256 res = "~"; break;
257 case "grave":
258 res = "`"; break;
259 case "bar":
260 res = "|"; break;
261 case "ampersand":
262 res = "&"; break;
263 case "parenleft":
264 res = "("; break;
265 case "parenright":
266 res = ")"; break;
267 case "less":
268 res = "<"; break;
269 case "greater":
270 res = ">"; break;
271 case "equal":
272 res = "="; break;
273 case "exclam":
274 res = "!"; break;
275 case "quotedbl":
276 res = "\""; break;
277 case "numbersign":
278 res = "\""; break;
279 case "dollar":
280 res = "$"; break;
281 case "slash":
282 res = "/"; break;
283 case "asterisk":
284 res = "*"; break;
285 case "colon":
286 res = ":"; break;
287 case "semicolon":
288 res = ";"; break;
289 case "underscore":
290 res = "_"; break;
291 case "Next":
292 res = "Pg▲"; break;
293 case "Prior":
294 res = "Pg▼"; break;
295 case "asciicircum":
296 res = "^"; break;
297 case "at":
298 res = "@"; break;
299 case "question":
300 res = "?"; break;
206 default:301 default:
207 if (keyvalue.length > 9)302 if (keyvalue.length > 9)
208 res = keyvalue.substring (0, 9);303 res = keyvalue.substring (0, 9);
@@ -212,12 +307,13 @@
212 if ((!keys.is_empty ()) &&307 if ((!keys.is_empty ()) &&
213 (keys.peek_head ().key == res) && 308 (keys.peek_head ().key == res) &&
214 (keys.peek_head ().ctrl == ctrl) && 309 (keys.peek_head ().ctrl == ctrl) &&
215 (keys.peek_head ().shift == shift) && 310 (keys.peek_head ().shift == shift) &&
216 (keys.peek_head ().alt == alt)){311 (keys.peek_head ().alt == alt) &&
312 (keys.peek_head ().iso_level3_shift == iso_level3_shift)){
217 keys.peek_head ().count ++;313 keys.peek_head ().count ++;
218 this.queue_draw ();314 this.queue_draw ();
219 }else{315 }else{
220 var key = new Key (res, ctrl, shift, alt, super);316 var key = new Key (res, ctrl, shift, alt, super, iso_level3_shift);
221 if (!released){317 if (!released){
222 keys.push_head (key);318 keys.push_head (key);
223 if (keys.length+2 > (screen_h / key_size))319 if (keys.length+2 > (screen_h / key_size))
224320
=== modified file 'src/Widgets/selectionarea.vala'
--- src/Widgets/selectionarea.vala 2012-03-23 15:01:29 +0000
+++ src/Widgets/selectionarea.vala 2012-03-27 11:57:47 +0000
@@ -94,24 +94,28 @@
94 public override bool draw (Cairo.Context ctx){94 public override bool draw (Cairo.Context ctx){
95 int w = this.get_allocated_width ();95 int w = this.get_allocated_width ();
96 int h = this.get_allocated_height ();96 int h = this.get_allocated_height ();
97 int r = 12;97 int r = 16;
98 if (!discrete){98 if (!discrete){
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
100 {w/2, 1}, // upper midpoint
101 {w-1, 1}, // upper right
102 {w-1, h/2}, // right midpoint
103 {w-1, h-1}, // lower right
104 {w/2, h-1}, // lower midpoint
105 {1, h-1}, // lower left
106 {1, h/2}}; // left midpoint
107
100 108
101 ctx.rectangle (r+1, r, w-2*r, h-2*r);109 ctx.rectangle (0, 0, w, h);
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);
103 ctx.fill ();111 ctx.fill ();
104 112
105 for (var i=0;i<8;i++){113 for (var i=0;i<8;i++){
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);
107 ctx.set_source_rgb (1.0, 1.0, 1.0);115 ctx.set_source_rgb (0.7, 0.7, 0.7);
108 ctx.fill ();116 ctx.fill ();
109 ctx.arc (pos[i,0], pos[i,1], r+1, 0.0, 2 * 3.14);
110 ctx.set_line_width (1.0);
111 ctx.set_source_rgba (0.0, 0.0, 0.0, 0.3);
112 ctx.stroke ();
113 }117 }
114 ctx.rectangle (r, r, w-2*r, h-2*r);118 ctx.rectangle (0, 0, w, h);
115 ctx.set_source_rgb (1.0, 1.0, 1.0);119 ctx.set_source_rgb (1.0, 1.0, 1.0);
116 ctx.set_line_width (1.0);120 ctx.set_line_width (1.0);
117 ctx.stroke ();121 ctx.stroke ();
@@ -135,7 +139,7 @@
135 this.set_keep_above (true);139 this.set_keep_above (true);
136 this.queue_draw ();140 this.queue_draw ();
137 this.resize (w+6, h+6);141 this.resize (w+6, h+6);
138 this.move (x, y-1);142 this.move (x-2, y-2);
139 this.deletable = false;143 this.deletable = false;
140 144
141 this.realize ();145 this.realize ();
@@ -147,7 +151,6 @@
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);
148 return true;152 return true;
149 });153 });
150
151 }154 }
152 }155 }
153}156}
154157
=== modified file 'src/eidete.vala'
--- src/eidete.vala 2012-03-23 14:57:45 +0000
+++ src/eidete.vala 2012-03-27 11:57:47 +0000
@@ -37,10 +37,9 @@
37 public int sy;37 public int sy;
38 public int ex;38 public int ex;
39 public int ey;39 public int ey;
40 public int screen;40 public int monitor;
41 public bool audio;41 public bool audio;
42 public bool keyview;42 public bool keyview;
43 public bool limits;
44 public string destination;43 public string destination;
45 }44 }
46 45
@@ -83,12 +82,14 @@
83 public Grid pause_grid;82 public Grid pause_grid;
84 public Image pause_icon;83 public Image pause_icon;
85 public Wnck.Window win;84 public Wnck.Window win;
85 public Gdk.Screen screen;
86 public Gdk.Rectangle monitor_rec;
86 87
87 public Settings settings;88 public Settings settings;
88 89
89 public bool recording;90 public bool recording;
90 public bool typing_size;91 public bool typing_size;
91 92
92 public EideteApp (){93 public EideteApp (){
93 }94 }
94 95
@@ -226,16 +227,25 @@
226 about_bt.clicked.connect ( () => {227 about_bt.clicked.connect ( () => {
227 this.show_about (this.main_window);228 this.show_about (this.main_window);
228 });229 });
229 230
230 settings.screen = 0;231 this.screen = Gdk.Screen.get_default();
232 settings.monitor = 0;
231 monitors_combo.changed.connect ( () => {233 monitors_combo.changed.connect ( () => {
232 settings.screen = int.parse (monitors_combo.active_id);234 settings.monitor = int.parse (monitors_combo.active_id);
235 this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec);
236 settings.sx = this.monitor_rec.x;
237 settings.sy = this.monitor_rec.y;
238 settings.ex = settings.sx + this.monitor_rec.width - 1;
239 settings.ey = settings.sy + this.monitor_rec.height - 1;
233 });240 });
234 241
235 settings.sx = 0;242 settings.monitor = int.parse (monitors_combo.active_id);
236 settings.sy = 0;243 this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec);
237 settings.ex = 0;244 settings.sx = this.monitor_rec.x;
238 settings.ey = 0;245 settings.sy = this.monitor_rec.y;
246 settings.ex = settings.sx + this.monitor_rec.width - 1;
247 settings.ey = settings.sy + this.monitor_rec.height - 1;
248
239 recordingarea_combo.changed.connect ( () => {249 recordingarea_combo.changed.connect ( () => {
240 if (recordingarea_combo.active_id != "full"){250 if (recordingarea_combo.active_id != "full"){
241 selectionarea = new Eidete.Widgets.SelectionArea ();251 selectionarea = new Eidete.Widgets.SelectionArea ();
@@ -248,18 +258,25 @@
248 height.value = (int)h;258 height.value = (int)h;
249 settings.sx = x;259 settings.sx = x;
250 settings.sy = y;260 settings.sy = y;
251 settings.ex = settings.sx+w;261 settings.ex = settings.sx+w-1;
252 settings.ey = settings.sy+h;262 settings.ey = settings.sy+h-1;
253 settings.limits = true;263 }
254 }264 });
265 selectionarea.focus_in_event.connect( (ev) => {
266 if (this.recording){
267 this.main_window.deiconify();
268 this.main_window.present();
269 }
270 return false;
255 });271 });
256 }else{272 }else{
257 selectionarea.destroy ();273 selectionarea.destroy ();
258 settings.sx = 0;274 settings.monitor = int.parse (monitors_combo.active_id);
259 settings.sy = 0;275 this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec);
260 settings.ex = 0;276 settings.sx = this.monitor_rec.x;
261 settings.ey = 0;277 settings.sy = this.monitor_rec.y;
262 settings.limits = false;278 settings.ex = settings.sx + this.monitor_rec.width - 1;
279 settings.ey = settings.sy + this.monitor_rec.height - 1;
263 width.set_sensitive (false);280 width.set_sensitive (false);
264 height.set_sensitive (false);281 height.set_sensitive (false);
265 }282 }
@@ -303,29 +320,40 @@
303 320
304 settings.destination = GLib.Environment.get_tmp_dir ()+321 settings.destination = GLib.Environment.get_tmp_dir ()+
305 "/screencast"+new GLib.DateTime.now_local ().to_unix ().to_string ()+".webm";322 "/screencast"+new GLib.DateTime.now_local ().to_unix ().to_string ()+".webm";
306 323
307 324 // ulong handle = 0;
308 ulong handle = 0;325 // handle = Wnck.Screen.get_default().active_window_changed.connect ( () => {
309 handle = Wnck.Screen.get_default ().active_window_changed.connect ( () => {326 // this.win = Wnck.Screen.get_default().get_active_window ();
310 this.win = Wnck.Screen.get_default ().get_active_window ();327 // print("setting active window\n");
311 this.win.state_changed.connect ( (changed_s, new_s) => {328 // this.win.state_changed.connect ( (changed_s, new_s) => {
312 if (recording && (new_s == 0)){329 // print("active window changed\n");
313 pipeline.set_state (State.PAUSED);330 // if (recording && (new_s == 0)){
314 this.recording = false;331 // pipeline.set_state (State.PAUSED);
315 switch_to_paused (true);332 // this.recording = false;
316 }333 // switch_to_paused (true);
317 });334 // }
318 Wnck.Screen.get_default ().disconnect (handle);335 // });
319 });336 // Wnck.Screen.get_default ().disconnect (handle);
320 337 // });
321 338
322 this.main_window.focus_in_event.connect ( (ev) => {339 // this.main_window.focus_in_event.connect ( (ev) => {
323 if (this.selectionarea != null && !this.selectionarea.not_visible){340 // if (this.selectionarea != null && !this.selectionarea.not_visible){
324 //this.selectionarea.present ();341 // //this.selectionarea.present ();
325 //this.main_window.present ();342 // //this.main_window.present ();
343 // }
344 // return false;
345 // });
346
347 this.main_window.visibility_notify_event.connect ( (ev) => {
348 if (this.recording && ev.state == 0){
349 print("pausing recording\n");
350 pipeline.set_state (State.PAUSED);
351 this.recording = false;
352 switch_to_paused (true);
326 }353 }
327 return false;354 return false;
328 });355 });
356
329 357
330 this.main_window.destroy.connect ( () => {358 this.main_window.destroy.connect ( () => {
331 if (pipeline != null)359 if (pipeline != null)
@@ -345,7 +373,7 @@
345 }373 }
346 }374 }
347 375
348 private void buid_pause_ui (){376 private void build_pause_ui (){
349 pause_grid = new Grid ();377 pause_grid = new Grid ();
350 pause_grid.margin = 12;378 pause_grid.margin = 12;
351 379
@@ -380,7 +408,9 @@
380 /*408 /*
381 Events409 Events
382 */410 */
383 cancel_bt.clicked.connect ( () => {this.main_window.destroy ();});411 cancel_bt.clicked.connect ( () => {
412 this.main_window.destroy ();
413 });
384 414
385 stop_bt.clicked.connect ( () => {415 stop_bt.clicked.connect ( () => {
386 var end = new Eidete.Widgets.EndDialog (this);416 var end = new Eidete.Widgets.EndDialog (this);
@@ -390,25 +420,25 @@
390 420
391 continue_bt.clicked.connect ( () => {421 continue_bt.clicked.connect ( () => {
392 this.main_window.iconify ();422 this.main_window.iconify ();
423 this.pipeline.set_state (State.PLAYING);
393 this.recording = true;424 this.recording = true;
394 this.pipeline.set_state (State.PLAYING);
395 switch_to_paused (false);425 switch_to_paused (false);
396 });426 });
397 }427 }
398 428
399 public void record (){429 public void record (){
400 this.recording = true;
401
402 if (settings.keyview){430 if (settings.keyview){
403 keyview = new Eidete.Widgets.KeyView ();431 keyview = new Eidete.Widgets.KeyView ();
404 if (settings.limits)432 keyview.focus_in_event.connect((ev) => {
405 keyview.place (selectionarea.x+selectionarea.w, 433 if (this.recording){
406 selectionarea.y, 434 this.main_window.deiconify();
407 selectionarea.h);435 this.main_window.present();
408 else436 }
409 keyview.place (Gdk.Screen.get_default ().get_width (), 437 return false;
410 0, 438 });
411 Gdk.Screen.get_default ().get_height ());439 keyview.place (settings.ex,
440 settings.sy,
441 settings.ey - settings.sy);
412 keyview.show_all ();442 keyview.show_all ();
413 }443 }
414 444
@@ -439,12 +469,12 @@
439 469
440 //configure470 //configure
441 sink.set ("location", settings.destination);471 sink.set ("location", settings.destination);
442 videobin.get_by_name ("videosrc").set ("startx", this.settings.sx+2);472 videobin.get_by_name ("videosrc").set ("startx", this.settings.sx);
443 videobin.get_by_name ("videosrc").set ("starty", this.settings.sy+1);473 videobin.get_by_name ("videosrc").set ("starty", this.settings.sy);
444 videobin.get_by_name ("videosrc").set ("endx", this.settings.ex+1);474 videobin.get_by_name ("videosrc").set ("endx", this.settings.ex);
445 videobin.get_by_name ("videosrc").set ("endy", this.settings.ey);475 videobin.get_by_name ("videosrc").set ("endy", this.settings.ey);
446 videobin.get_by_name ("videosrc").set ("use-damage", false);476 videobin.get_by_name ("videosrc").set ("use-damage", false);
447 videobin.get_by_name ("videosrc").set ("screen-num", this.settings.screen);477 videobin.get_by_name ("videosrc").set ("screen-num", this.settings.monitor);
448 478
449 //videobin.get_by_name ("encoder").set ("mode", 1);479 //videobin.get_by_name ("encoder").set ("mode", 1);
450 videobin.get_by_name ("encoder").set ("quality", 10.0);480 videobin.get_by_name ("encoder").set ("quality", 10.0);
@@ -477,6 +507,7 @@
477 selectionarea.to_discrete ();507 selectionarea.to_discrete ();
478 508
479 pipeline.set_state (State.PLAYING);509 pipeline.set_state (State.PLAYING);
510 this.recording = true;
480 }511 }
481 512
482 private bool bus_message_cb (Gst.Bus bus, Message msg){513 private bool bus_message_cb (Gst.Bus bus, Message msg){
@@ -503,7 +534,7 @@
503 this.main_window.title = _("Recording paused");534 this.main_window.title = _("Recording paused");
504 this.main_window.remove (pause_icon);535 this.main_window.remove (pause_icon);
505 if (pause_grid == null)536 if (pause_grid == null)
506 this.buid_pause_ui ();537 this.build_pause_ui ();
507 this.main_window.add (pause_grid);538 this.main_window.add (pause_grid);
508 this.main_window.icon_name = "eidete";539 this.main_window.icon_name = "eidete";
509 this.app_icon = "eidete";540 this.app_icon = "eidete";
510541
=== modified file 'src/keycapture.c'
--- src/keycapture.c 2012-01-02 22:50:13 +0000
+++ src/keycapture.c 2012-03-27 11:57:47 +0000
@@ -2,6 +2,7 @@
2#include <glib.h>2#include <glib.h>
3#include <X11/Xproto.h>3#include <X11/Xproto.h>
4#include <X11/Xlib.h>4#include <X11/Xlib.h>
5#include <X11/XKBlib.h>
5#include <X11/extensions/record.h> //libxtst-dev, Xtst6#include <X11/extensions/record.h> //libxtst-dev, Xtst
6#include <gstreamer-0.10/gst/gst.h>7#include <gstreamer-0.10/gst/gst.h>
7#include <gstreamer-0.10/gst/gstinterface.h>8#include <gstreamer-0.10/gst/gstinterface.h>
@@ -18,13 +19,22 @@
1819
19void key_pressed_cb(XPointer arg, XRecordInterceptData *d) {20void key_pressed_cb(XPointer arg, XRecordInterceptData *d) {
20 if (d->category != XRecordFromServer) return;21 if (d->category != XRecordFromServer) return;
22
23 xEvent* event = (xEvent*)d->data;
24
21 unsigned char type = ((unsigned char*)d->data)[0] & 0x7F;25 unsigned char type = ((unsigned char*)d->data)[0] & 0x7F;
22 unsigned char detail = ((unsigned char*)d->data)[1];26 unsigned char detail = ((unsigned char*)d->data)[1];
27 unsigned int shiftlevel = 0;
28
29 if( event->u.keyButtonPointer.state == 0 ||
30 event->u.keyButtonPointer.state == 1 ) {
31 shiftlevel = event->u.keyButtonPointer.state;
32 }
23 33
24 if (type == KeyPress) {34 if (type == KeyPress) {
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);
26 }else if (type == KeyRelease){36 }else if (type == KeyRelease){
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);
28 }38 }
29}39}
3040
@@ -33,7 +43,7 @@
33 XRecordRange* rr;43 XRecordRange* rr;
34 dpy = XOpenDisplay (0);44 dpy = XOpenDisplay (0);
35 45
36 XKeysymToString (XKeycodeToKeysym (dpy, 11, 1));46 XKeysymToString (XkbKeycodeToKeysym (dpy, 11, 1, 0));
37 47
38 if (!(rr = XRecordAllocRange())) {48 if (!(rr = XRecordAllocRange())) {
39 fprintf(stderr, "XRecordAllocRange error\n");49 fprintf(stderr, "XRecordAllocRange error\n");

Subscribers

People subscribed via source and target branches