Merge lp:~tintou/eidete/eidete into lp:eidete

Proposed by Corentin Noël
Status: Merged
Approved by: Danielle Foré
Approved revision: 209
Merged at revision: 209
Proposed branch: lp:~tintou/eidete/eidete
Merge into: lp:eidete
Diff against target: 204 lines (+52/-41)
2 files modified
src/Widgets/selectionarea.vala (+20/-14)
src/eidete.vala (+32/-27)
To merge this branch: bzr merge lp:~tintou/eidete/eidete
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+313931@code.launchpad.net

Commit message

Support for HiDPI
Fixed broken translation

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Widgets/selectionarea.vala'
--- src/Widgets/selectionarea.vala 2015-01-06 13:29:27 +0000
+++ src/Widgets/selectionarea.vala 2016-12-31 18:23:09 +0000
@@ -57,43 +57,49 @@
57 });57 });
5858
59 this.configure_event.connect ((e) => {59 this.configure_event.connect ((e) => {
60 var screen_width = Gdk.Screen.width ();60 var scale = get_scale_factor ();
61 var screen_height = Gdk.Screen.height ();61 var screen_width = Gdk.Screen.width () * scale;
62 var screen_height = Gdk.Screen.height () * scale;
63
64 var e_x = e.x * scale;
65 var e_y= e.y * scale;
66 var e_width = e.width * scale;
67 var e_height = e.height * scale;
6268
63 // check if coordinates are out of the screen and check69 // check if coordinates are out of the screen and check
64 // if coordinate + width/height is out of the screen, then70 // if coordinate + width/height is out of the screen, then
65 // adjust coordinates to keep width and height (and aspect71 // adjust coordinates to keep width and height (and aspect
66 // ratio) intact72 // ratio) intact
6773
68 if (e.x < 0 || e.x > screen_width) {74 if (e_x < 0 || e_x > screen_width) {
69 x = 0;75 x = 0;
70 } else if (e.x + e.width > screen_width && e.width < screen_width) {76 } else if (e_x + e_width > screen_width && e_width < screen_width) {
71 x = screen_width - e.width;77 x = screen_width - e_width;
72 } else {78 } else {
73 x = e.x;79 x = e_x;
74 }80 }
7581
76 if (e.y < 0) {82 if (e_y < 0) {
77 y = 0;83 y = 0;
78 } else if (e.y + e.height >= screen_height && e.height < screen_height) {84 } else if (e_y + e_height >= screen_height && e_height < screen_height) {
79 y = screen_height - e.height - 1;85 y = screen_height - e_height - 1;
80 } else {86 } else {
81 y = e.y;87 y = e_y;
82 }88 }
8389
84 // just in case an edge is still outside of the screen90 // just in case an edge is still outside of the screen
85 // we'll modify the width/height if thats the case91 // we'll modify the width/height if thats the case
8692
87 if (x + e.width > screen_width) {93 if (x + e_width > screen_width) {
88 w = screen_width - x;94 w = screen_width - x;
89 } else {95 } else {
90 w = e.width;96 w = e_width;
91 }97 }
9298
93 if (y + e.height > screen_height) {99 if (y + e_height > screen_height) {
94 h = screen_height - y;100 h = screen_height - y;
95 } else {101 } else {
96 h = e.height;102 h = e_height;
97 }103 }
98104
99 geometry_changed (x, y, w, h);105 geometry_changed (x, y, w, h);
100106
=== modified file 'src/eidete.vala'
--- src/eidete.vala 2015-01-20 22:36:51 +0000
+++ src/eidete.vala 2016-12-31 18:23:09 +0000
@@ -115,6 +115,7 @@
115 public void start_and_build () {115 public void start_and_build () {
116 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;116 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
117117
118 this.screen = Gdk.Screen.get_default ();
118 this.main_window = new Gtk.Window ();119 this.main_window = new Gtk.Window ();
119 this.main_window.icon_name = exec_name;120 this.main_window.icon_name = exec_name;
120 this.main_window.set_application (this);121 this.main_window.set_application (this);
@@ -147,21 +148,23 @@
147 var monitors_combo = new Gtk.ComboBoxText ();148 var monitors_combo = new Gtk.ComboBoxText ();
148 monitors_combo.hexpand = true;149 monitors_combo.hexpand = true;
149150
150 for (var i = 0; i < Gdk.Screen.get_default ().get_n_monitors (); i++) {151 for (var i = 0; i < screen.get_n_monitors (); i++) {
151 // TODO proper translation here152 // TODO proper translation here
152 monitors_combo.append (i.to_string (), _("Monitor") + " " + (i + 1).to_string ());153 monitors_combo.append (i.to_string (), _("Monitor") + " " + (i + 1).to_string ());
153 }154 }
154155
155 monitors_combo.active = 0;156 monitors_combo.active = 0;
156157
157 if (Gdk.Screen.get_default ().get_n_monitors () == 1)158 if (screen.get_n_monitors () == 1)
158 monitors_combo.set_sensitive (false);159 monitors_combo.set_sensitive (false);
159160
160 var width = new Gtk.SpinButton.with_range (50, Gdk.Screen.get_default ().get_width (), 1);161 var primary = screen.get_primary_monitor ();
162 var scale = screen.get_monitor_scale_factor (primary);
163 var width = new Gtk.SpinButton.with_range (50, screen.get_width () * scale, 1);
161 width.max_length = 4;164 width.max_length = 4;
162 width.margin_left = 1;165 width.margin_left = 1;
163166
164 var height = new Gtk.SpinButton.with_range (50, Gdk.Screen.get_default ().get_height (), 1);167 var height = new Gtk.SpinButton.with_range (50, screen.get_height () * scale, 1);
165 height.max_length = 4;168 height.max_length = 4;
166 height.margin_left = 1;169 height.margin_left = 1;
167 width.set_sensitive (false);170 width.set_sensitive (false);
@@ -204,18 +207,18 @@
204 mouse.margin_top = 12;207 mouse.margin_top = 12;
205208
206 grid.attach (sound, 0, 0, 1, 1);209 grid.attach (sound, 0, 0, 1, 1);
207 grid.attach (new LLabel.right (_("Record Computer Sounds") + ":"), 0, 1, 1, 1);210 grid.attach (new LLabel.right (_("Record Computer Sounds:")), 0, 1, 1, 1);
208 grid.attach (use_comp_sounds, 1, 1, 1, 1);211 grid.attach (use_comp_sounds, 1, 1, 1, 1);
209 grid.attach (new LLabel.right (_("Record from Microphone") + ":"), 0, 2, 1, 1);212 grid.attach (new LLabel.right (_("Record from Microphone:")), 0, 2, 1, 1);
210 grid.attach (audio_box, 1, 2, 1, 1);213 grid.attach (audio_box, 1, 2, 1, 1);
211 grid.attach ((video), 0, 3, 2, 1);214 grid.attach ((video), 0, 3, 2, 1);
212 grid.attach (new LLabel.right (" " + _("Record from Monitor") + ":"), 0, 4, 1, 1);215 grid.attach (new LLabel.right (_("Record from Monitor:")), 0, 4, 1, 1);
213 grid.attach (monitors_combo, 1, 4, 1, 1);216 grid.attach (monitors_combo, 1, 4, 1, 1);
214 grid.attach (new LLabel.right (_("Recording Area") + ":"), 0, 5, 1, 1);217 grid.attach (new LLabel.right (_("Recording Area:")), 0, 5, 1, 1);
215 grid.attach (recordingarea_combo, 1, 5, 1, 1);218 grid.attach (recordingarea_combo, 1, 5, 1, 1);
216 grid.attach (new LLabel.right (_("Width") + ":"), 0, 6, 1, 1);219 grid.attach (new LLabel.right (_("Width:")), 0, 6, 1, 1);
217 grid.attach (width, 1, 6, 1, 1);220 grid.attach (width, 1, 6, 1, 1);
218 grid.attach (new LLabel.right (_("Height") + ":"), 0, 7, 1, 1);221 grid.attach (new LLabel.right (_("Height:")), 0, 7, 1, 1);
219 grid.attach (height, 1, 7, 1, 1);222 grid.attach (height, 1, 7, 1, 1);
220223
221 // grid2224 // grid2
@@ -237,12 +240,12 @@
237 circle_box.pack_start (circle_color);240 circle_box.pack_start (circle_color);
238241
239 grid2.attach ((keyboard), 0, 0, 1, 1);242 grid2.attach ((keyboard), 0, 0, 1, 1);
240 grid2.attach (new LLabel.right (_("Pressed keys on screen") + ":"), 0, 1, 1, 1);243 grid2.attach (new LLabel.right (_("Pressed keys on screen:")), 0, 1, 1, 1);
241 grid2.attach (use_keyview, 1, 1, 1, 1);244 grid2.attach (use_keyview, 1, 1, 1, 1);
242 grid2.attach ((mouse), 0, 2, 1, 1);245 grid2.attach ((mouse), 0, 2, 1, 1);
243 grid2.attach (new LLabel.right (_("Mouse clicks on screen") + ":"), 0, 3, 1, 1);246 grid2.attach (new LLabel.right (_("Mouse clicks on screen:")), 0, 3, 1, 1);
244 grid2.attach (use_clickview, 1, 3, 1, 1);247 grid2.attach (use_clickview, 1, 3, 1, 1);
245 grid2.attach (new LLabel.right (_("Circle around the cursor") + ":"), 0, 4, 1, 1);248 grid2.attach (new LLabel.right (_("Circle around the cursor:")), 0, 4, 1, 1);
246 grid2.attach (circle_box, 1, 4, 1, 1);249 grid2.attach (circle_box, 1, 4, 1, 1);
247 grid2.column_spacing = 12;250 grid2.column_spacing = 12;
248 grid2.row_spacing = 6;251 grid2.row_spacing = 6;
@@ -307,27 +310,28 @@
307 count.start (this);310 count.start (this);
308 });311 });
309312
310 this.screen = Gdk.Screen.get_default ();
311 settings.monitor = 0;313 settings.monitor = 0;
312 monitors_combo.changed.connect (() => {314 monitors_combo.changed.connect (() => {
313 settings.monitor = int.parse (monitors_combo.active_id);315 settings.monitor = int.parse (monitors_combo.active_id);
314316
315 this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec);317 this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);
318 var _scale = screen.get_monitor_scale_factor (settings.monitor);
316319
317 settings.sx = this.monitor_rec.x;320 settings.sx = this.monitor_rec.x * _scale;
318 settings.sy = this.monitor_rec.y;321 settings.sy = this.monitor_rec.y * _scale;
319 settings.ex = settings.sx + this.monitor_rec.width - 1;322 settings.ex = settings.sx + this.monitor_rec.width * _scale - 1;
320 settings.ey = settings.sy + this.monitor_rec.height - 1;323 settings.ey = settings.sy + this.monitor_rec.height * _scale - 1;
321 });324 });
322325
323 settings.monitor = int.parse (monitors_combo.active_id);326 settings.monitor = int.parse (monitors_combo.active_id);
324327
325 this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);328 this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);
329 scale = screen.get_monitor_scale_factor (settings.monitor);
326330
327 settings.sx = this.monitor_rec.x;331 settings.sx = this.monitor_rec.x * scale;
328 settings.sy = this.monitor_rec.y;332 settings.sy = this.monitor_rec.y * scale;
329 settings.ex = settings.sx + this.monitor_rec.width - 1;333 settings.ex = settings.sx + this.monitor_rec.width * scale - 1;
330 settings.ey = settings.sy + this.monitor_rec.height - 1;334 settings.ey = settings.sy + this.monitor_rec.height * scale - 1;
331335
332 recordingarea_combo.changed.connect (() => {336 recordingarea_combo.changed.connect (() => {
333 if (recordingarea_combo.active_id != "full"){337 if (recordingarea_combo.active_id != "full"){
@@ -359,11 +363,12 @@
359 settings.monitor = int.parse (monitors_combo.active_id);363 settings.monitor = int.parse (monitors_combo.active_id);
360364
361 this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);365 this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);
366 var _scale = screen.get_monitor_scale_factor (settings.monitor);
362367
363 settings.sx = this.monitor_rec.x;368 settings.sx = this.monitor_rec.x * _scale;
364 settings.sy = this.monitor_rec.y;369 settings.sy = this.monitor_rec.y * _scale;
365 settings.ex = settings.sx + this.monitor_rec.width - 1;370 settings.ex = settings.sx + this.monitor_rec.width * _scale - 1;
366 settings.ey = settings.sy + this.monitor_rec.height - 1;371 settings.ey = settings.sy + this.monitor_rec.height * _scale - 1;
367372
368 width.set_sensitive (false);373 width.set_sensitive (false);
369 height.set_sensitive (false);374 height.set_sensitive (false);

Subscribers

People subscribed via source and target branches