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
1=== modified file 'src/Widgets/selectionarea.vala'
2--- src/Widgets/selectionarea.vala 2015-01-06 13:29:27 +0000
3+++ src/Widgets/selectionarea.vala 2016-12-31 18:23:09 +0000
4@@ -57,43 +57,49 @@
5 });
6
7 this.configure_event.connect ((e) => {
8- var screen_width = Gdk.Screen.width ();
9- var screen_height = Gdk.Screen.height ();
10+ var scale = get_scale_factor ();
11+ var screen_width = Gdk.Screen.width () * scale;
12+ var screen_height = Gdk.Screen.height () * scale;
13+
14+ var e_x = e.x * scale;
15+ var e_y= e.y * scale;
16+ var e_width = e.width * scale;
17+ var e_height = e.height * scale;
18
19 // check if coordinates are out of the screen and check
20 // if coordinate + width/height is out of the screen, then
21 // adjust coordinates to keep width and height (and aspect
22 // ratio) intact
23
24- if (e.x < 0 || e.x > screen_width) {
25+ if (e_x < 0 || e_x > screen_width) {
26 x = 0;
27- } else if (e.x + e.width > screen_width && e.width < screen_width) {
28- x = screen_width - e.width;
29+ } else if (e_x + e_width > screen_width && e_width < screen_width) {
30+ x = screen_width - e_width;
31 } else {
32- x = e.x;
33+ x = e_x;
34 }
35
36- if (e.y < 0) {
37+ if (e_y < 0) {
38 y = 0;
39- } else if (e.y + e.height >= screen_height && e.height < screen_height) {
40- y = screen_height - e.height - 1;
41+ } else if (e_y + e_height >= screen_height && e_height < screen_height) {
42+ y = screen_height - e_height - 1;
43 } else {
44- y = e.y;
45+ y = e_y;
46 }
47
48 // just in case an edge is still outside of the screen
49 // we'll modify the width/height if thats the case
50
51- if (x + e.width > screen_width) {
52+ if (x + e_width > screen_width) {
53 w = screen_width - x;
54 } else {
55- w = e.width;
56+ w = e_width;
57 }
58
59- if (y + e.height > screen_height) {
60+ if (y + e_height > screen_height) {
61 h = screen_height - y;
62 } else {
63- h = e.height;
64+ h = e_height;
65 }
66
67 geometry_changed (x, y, w, h);
68
69=== modified file 'src/eidete.vala'
70--- src/eidete.vala 2015-01-20 22:36:51 +0000
71+++ src/eidete.vala 2016-12-31 18:23:09 +0000
72@@ -115,6 +115,7 @@
73 public void start_and_build () {
74 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
75
76+ this.screen = Gdk.Screen.get_default ();
77 this.main_window = new Gtk.Window ();
78 this.main_window.icon_name = exec_name;
79 this.main_window.set_application (this);
80@@ -147,21 +148,23 @@
81 var monitors_combo = new Gtk.ComboBoxText ();
82 monitors_combo.hexpand = true;
83
84- for (var i = 0; i < Gdk.Screen.get_default ().get_n_monitors (); i++) {
85+ for (var i = 0; i < screen.get_n_monitors (); i++) {
86 // TODO proper translation here
87 monitors_combo.append (i.to_string (), _("Monitor") + " " + (i + 1).to_string ());
88 }
89
90 monitors_combo.active = 0;
91
92- if (Gdk.Screen.get_default ().get_n_monitors () == 1)
93+ if (screen.get_n_monitors () == 1)
94 monitors_combo.set_sensitive (false);
95
96- var width = new Gtk.SpinButton.with_range (50, Gdk.Screen.get_default ().get_width (), 1);
97+ var primary = screen.get_primary_monitor ();
98+ var scale = screen.get_monitor_scale_factor (primary);
99+ var width = new Gtk.SpinButton.with_range (50, screen.get_width () * scale, 1);
100 width.max_length = 4;
101 width.margin_left = 1;
102
103- var height = new Gtk.SpinButton.with_range (50, Gdk.Screen.get_default ().get_height (), 1);
104+ var height = new Gtk.SpinButton.with_range (50, screen.get_height () * scale, 1);
105 height.max_length = 4;
106 height.margin_left = 1;
107 width.set_sensitive (false);
108@@ -204,18 +207,18 @@
109 mouse.margin_top = 12;
110
111 grid.attach (sound, 0, 0, 1, 1);
112- grid.attach (new LLabel.right (_("Record Computer Sounds") + ":"), 0, 1, 1, 1);
113+ grid.attach (new LLabel.right (_("Record Computer Sounds:")), 0, 1, 1, 1);
114 grid.attach (use_comp_sounds, 1, 1, 1, 1);
115- grid.attach (new LLabel.right (_("Record from Microphone") + ":"), 0, 2, 1, 1);
116+ grid.attach (new LLabel.right (_("Record from Microphone:")), 0, 2, 1, 1);
117 grid.attach (audio_box, 1, 2, 1, 1);
118 grid.attach ((video), 0, 3, 2, 1);
119- grid.attach (new LLabel.right (" " + _("Record from Monitor") + ":"), 0, 4, 1, 1);
120+ grid.attach (new LLabel.right (_("Record from Monitor:")), 0, 4, 1, 1);
121 grid.attach (monitors_combo, 1, 4, 1, 1);
122- grid.attach (new LLabel.right (_("Recording Area") + ":"), 0, 5, 1, 1);
123+ grid.attach (new LLabel.right (_("Recording Area:")), 0, 5, 1, 1);
124 grid.attach (recordingarea_combo, 1, 5, 1, 1);
125- grid.attach (new LLabel.right (_("Width") + ":"), 0, 6, 1, 1);
126+ grid.attach (new LLabel.right (_("Width:")), 0, 6, 1, 1);
127 grid.attach (width, 1, 6, 1, 1);
128- grid.attach (new LLabel.right (_("Height") + ":"), 0, 7, 1, 1);
129+ grid.attach (new LLabel.right (_("Height:")), 0, 7, 1, 1);
130 grid.attach (height, 1, 7, 1, 1);
131
132 // grid2
133@@ -237,12 +240,12 @@
134 circle_box.pack_start (circle_color);
135
136 grid2.attach ((keyboard), 0, 0, 1, 1);
137- grid2.attach (new LLabel.right (_("Pressed keys on screen") + ":"), 0, 1, 1, 1);
138+ grid2.attach (new LLabel.right (_("Pressed keys on screen:")), 0, 1, 1, 1);
139 grid2.attach (use_keyview, 1, 1, 1, 1);
140 grid2.attach ((mouse), 0, 2, 1, 1);
141- grid2.attach (new LLabel.right (_("Mouse clicks on screen") + ":"), 0, 3, 1, 1);
142+ grid2.attach (new LLabel.right (_("Mouse clicks on screen:")), 0, 3, 1, 1);
143 grid2.attach (use_clickview, 1, 3, 1, 1);
144- grid2.attach (new LLabel.right (_("Circle around the cursor") + ":"), 0, 4, 1, 1);
145+ grid2.attach (new LLabel.right (_("Circle around the cursor:")), 0, 4, 1, 1);
146 grid2.attach (circle_box, 1, 4, 1, 1);
147 grid2.column_spacing = 12;
148 grid2.row_spacing = 6;
149@@ -307,27 +310,28 @@
150 count.start (this);
151 });
152
153- this.screen = Gdk.Screen.get_default ();
154 settings.monitor = 0;
155 monitors_combo.changed.connect (() => {
156 settings.monitor = int.parse (monitors_combo.active_id);
157
158- this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec);
159+ this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);
160+ var _scale = screen.get_monitor_scale_factor (settings.monitor);
161
162- settings.sx = this.monitor_rec.x;
163- settings.sy = this.monitor_rec.y;
164- settings.ex = settings.sx + this.monitor_rec.width - 1;
165- settings.ey = settings.sy + this.monitor_rec.height - 1;
166+ settings.sx = this.monitor_rec.x * _scale;
167+ settings.sy = this.monitor_rec.y * _scale;
168+ settings.ex = settings.sx + this.monitor_rec.width * _scale - 1;
169+ settings.ey = settings.sy + this.monitor_rec.height * _scale - 1;
170 });
171
172 settings.monitor = int.parse (monitors_combo.active_id);
173
174 this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);
175+ scale = screen.get_monitor_scale_factor (settings.monitor);
176
177- settings.sx = this.monitor_rec.x;
178- settings.sy = this.monitor_rec.y;
179- settings.ex = settings.sx + this.monitor_rec.width - 1;
180- settings.ey = settings.sy + this.monitor_rec.height - 1;
181+ settings.sx = this.monitor_rec.x * scale;
182+ settings.sy = this.monitor_rec.y * scale;
183+ settings.ex = settings.sx + this.monitor_rec.width * scale - 1;
184+ settings.ey = settings.sy + this.monitor_rec.height * scale - 1;
185
186 recordingarea_combo.changed.connect (() => {
187 if (recordingarea_combo.active_id != "full"){
188@@ -359,11 +363,12 @@
189 settings.monitor = int.parse (monitors_combo.active_id);
190
191 this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec);
192+ var _scale = screen.get_monitor_scale_factor (settings.monitor);
193
194- settings.sx = this.monitor_rec.x;
195- settings.sy = this.monitor_rec.y;
196- settings.ex = settings.sx + this.monitor_rec.width - 1;
197- settings.ey = settings.sy + this.monitor_rec.height - 1;
198+ settings.sx = this.monitor_rec.x * _scale;
199+ settings.sy = this.monitor_rec.y * _scale;
200+ settings.ex = settings.sx + this.monitor_rec.width * _scale - 1;
201+ settings.ey = settings.sy + this.monitor_rec.height * _scale - 1;
202
203 width.set_sensitive (false);
204 height.set_sensitive (false);

Subscribers

People subscribed via source and target branches