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 |
Related bugs: |
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
Description of the change
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 | 57 | }); | 57 | }); |
6 | 58 | 58 | ||
7 | 59 | this.configure_event.connect ((e) => { | 59 | this.configure_event.connect ((e) => { |
10 | 60 | var screen_width = Gdk.Screen.width (); | 60 | var scale = get_scale_factor (); |
11 | 61 | var screen_height = Gdk.Screen.height (); | 61 | var screen_width = Gdk.Screen.width () * scale; |
12 | 62 | var screen_height = Gdk.Screen.height () * scale; | ||
13 | 63 | |||
14 | 64 | var e_x = e.x * scale; | ||
15 | 65 | var e_y= e.y * scale; | ||
16 | 66 | var e_width = e.width * scale; | ||
17 | 67 | var e_height = e.height * scale; | ||
18 | 62 | 68 | ||
19 | 63 | // check if coordinates are out of the screen and check | 69 | // check if coordinates are out of the screen and check |
20 | 64 | // if coordinate + width/height is out of the screen, then | 70 | // if coordinate + width/height is out of the screen, then |
21 | 65 | // adjust coordinates to keep width and height (and aspect | 71 | // adjust coordinates to keep width and height (and aspect |
22 | 66 | // ratio) intact | 72 | // ratio) intact |
23 | 67 | 73 | ||
25 | 68 | if (e.x < 0 || e.x > screen_width) { | 74 | if (e_x < 0 || e_x > screen_width) { |
26 | 69 | x = 0; | 75 | x = 0; |
29 | 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) { |
30 | 71 | x = screen_width - e.width; | 77 | x = screen_width - e_width; |
31 | 72 | } else { | 78 | } else { |
33 | 73 | x = e.x; | 79 | x = e_x; |
34 | 74 | } | 80 | } |
35 | 75 | 81 | ||
37 | 76 | if (e.y < 0) { | 82 | if (e_y < 0) { |
38 | 77 | y = 0; | 83 | y = 0; |
41 | 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) { |
42 | 79 | y = screen_height - e.height - 1; | 85 | y = screen_height - e_height - 1; |
43 | 80 | } else { | 86 | } else { |
45 | 81 | y = e.y; | 87 | y = e_y; |
46 | 82 | } | 88 | } |
47 | 83 | 89 | ||
48 | 84 | // just in case an edge is still outside of the screen | 90 | // just in case an edge is still outside of the screen |
49 | 85 | // we'll modify the width/height if thats the case | 91 | // we'll modify the width/height if thats the case |
50 | 86 | 92 | ||
52 | 87 | if (x + e.width > screen_width) { | 93 | if (x + e_width > screen_width) { |
53 | 88 | w = screen_width - x; | 94 | w = screen_width - x; |
54 | 89 | } else { | 95 | } else { |
56 | 90 | w = e.width; | 96 | w = e_width; |
57 | 91 | } | 97 | } |
58 | 92 | 98 | ||
60 | 93 | if (y + e.height > screen_height) { | 99 | if (y + e_height > screen_height) { |
61 | 94 | h = screen_height - y; | 100 | h = screen_height - y; |
62 | 95 | } else { | 101 | } else { |
64 | 96 | h = e.height; | 102 | h = e_height; |
65 | 97 | } | 103 | } |
66 | 98 | 104 | ||
67 | 99 | geometry_changed (x, y, w, h); | 105 | geometry_changed (x, y, w, h); |
68 | 100 | 106 | ||
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 | 115 | public void start_and_build () { | 115 | public void start_and_build () { |
74 | 116 | Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true; | 116 | Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true; |
75 | 117 | 117 | ||
76 | 118 | this.screen = Gdk.Screen.get_default (); | ||
77 | 118 | this.main_window = new Gtk.Window (); | 119 | this.main_window = new Gtk.Window (); |
78 | 119 | this.main_window.icon_name = exec_name; | 120 | this.main_window.icon_name = exec_name; |
79 | 120 | this.main_window.set_application (this); | 121 | this.main_window.set_application (this); |
80 | @@ -147,21 +148,23 @@ | |||
81 | 147 | var monitors_combo = new Gtk.ComboBoxText (); | 148 | var monitors_combo = new Gtk.ComboBoxText (); |
82 | 148 | monitors_combo.hexpand = true; | 149 | monitors_combo.hexpand = true; |
83 | 149 | 150 | ||
85 | 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++) { |
86 | 151 | // TODO proper translation here | 152 | // TODO proper translation here |
87 | 152 | monitors_combo.append (i.to_string (), _("Monitor") + " " + (i + 1).to_string ()); | 153 | monitors_combo.append (i.to_string (), _("Monitor") + " " + (i + 1).to_string ()); |
88 | 153 | } | 154 | } |
89 | 154 | 155 | ||
90 | 155 | monitors_combo.active = 0; | 156 | monitors_combo.active = 0; |
91 | 156 | 157 | ||
93 | 157 | if (Gdk.Screen.get_default ().get_n_monitors () == 1) | 158 | if (screen.get_n_monitors () == 1) |
94 | 158 | monitors_combo.set_sensitive (false); | 159 | monitors_combo.set_sensitive (false); |
95 | 159 | 160 | ||
97 | 160 | var width = new Gtk.SpinButton.with_range (50, Gdk.Screen.get_default ().get_width (), 1); | 161 | var primary = screen.get_primary_monitor (); |
98 | 162 | var scale = screen.get_monitor_scale_factor (primary); | ||
99 | 163 | var width = new Gtk.SpinButton.with_range (50, screen.get_width () * scale, 1); | ||
100 | 161 | width.max_length = 4; | 164 | width.max_length = 4; |
101 | 162 | width.margin_left = 1; | 165 | width.margin_left = 1; |
102 | 163 | 166 | ||
104 | 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); |
105 | 165 | height.max_length = 4; | 168 | height.max_length = 4; |
106 | 166 | height.margin_left = 1; | 169 | height.margin_left = 1; |
107 | 167 | width.set_sensitive (false); | 170 | width.set_sensitive (false); |
108 | @@ -204,18 +207,18 @@ | |||
109 | 204 | mouse.margin_top = 12; | 207 | mouse.margin_top = 12; |
110 | 205 | 208 | ||
111 | 206 | grid.attach (sound, 0, 0, 1, 1); | 209 | grid.attach (sound, 0, 0, 1, 1); |
113 | 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); |
114 | 208 | grid.attach (use_comp_sounds, 1, 1, 1, 1); | 211 | grid.attach (use_comp_sounds, 1, 1, 1, 1); |
116 | 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); |
117 | 210 | grid.attach (audio_box, 1, 2, 1, 1); | 213 | grid.attach (audio_box, 1, 2, 1, 1); |
118 | 211 | grid.attach ((video), 0, 3, 2, 1); | 214 | grid.attach ((video), 0, 3, 2, 1); |
120 | 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); |
121 | 213 | grid.attach (monitors_combo, 1, 4, 1, 1); | 216 | grid.attach (monitors_combo, 1, 4, 1, 1); |
123 | 214 | grid.attach (new LLabel.right (_("Recording Area") + ":"), 0, 5, 1, 1); | 217 | grid.attach (new LLabel.right (_("Recording Area:")), 0, 5, 1, 1); |
124 | 215 | grid.attach (recordingarea_combo, 1, 5, 1, 1); | 218 | grid.attach (recordingarea_combo, 1, 5, 1, 1); |
126 | 216 | grid.attach (new LLabel.right (_("Width") + ":"), 0, 6, 1, 1); | 219 | grid.attach (new LLabel.right (_("Width:")), 0, 6, 1, 1); |
127 | 217 | grid.attach (width, 1, 6, 1, 1); | 220 | grid.attach (width, 1, 6, 1, 1); |
129 | 218 | grid.attach (new LLabel.right (_("Height") + ":"), 0, 7, 1, 1); | 221 | grid.attach (new LLabel.right (_("Height:")), 0, 7, 1, 1); |
130 | 219 | grid.attach (height, 1, 7, 1, 1); | 222 | grid.attach (height, 1, 7, 1, 1); |
131 | 220 | 223 | ||
132 | 221 | // grid2 | 224 | // grid2 |
133 | @@ -237,12 +240,12 @@ | |||
134 | 237 | circle_box.pack_start (circle_color); | 240 | circle_box.pack_start (circle_color); |
135 | 238 | 241 | ||
136 | 239 | grid2.attach ((keyboard), 0, 0, 1, 1); | 242 | grid2.attach ((keyboard), 0, 0, 1, 1); |
138 | 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); |
139 | 241 | grid2.attach (use_keyview, 1, 1, 1, 1); | 244 | grid2.attach (use_keyview, 1, 1, 1, 1); |
140 | 242 | grid2.attach ((mouse), 0, 2, 1, 1); | 245 | grid2.attach ((mouse), 0, 2, 1, 1); |
142 | 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); |
143 | 244 | grid2.attach (use_clickview, 1, 3, 1, 1); | 247 | grid2.attach (use_clickview, 1, 3, 1, 1); |
145 | 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); |
146 | 246 | grid2.attach (circle_box, 1, 4, 1, 1); | 249 | grid2.attach (circle_box, 1, 4, 1, 1); |
147 | 247 | grid2.column_spacing = 12; | 250 | grid2.column_spacing = 12; |
148 | 248 | grid2.row_spacing = 6; | 251 | grid2.row_spacing = 6; |
149 | @@ -307,27 +310,28 @@ | |||
150 | 307 | count.start (this); | 310 | count.start (this); |
151 | 308 | }); | 311 | }); |
152 | 309 | 312 | ||
153 | 310 | this.screen = Gdk.Screen.get_default (); | ||
154 | 311 | settings.monitor = 0; | 313 | settings.monitor = 0; |
155 | 312 | monitors_combo.changed.connect (() => { | 314 | monitors_combo.changed.connect (() => { |
156 | 313 | settings.monitor = int.parse (monitors_combo.active_id); | 315 | settings.monitor = int.parse (monitors_combo.active_id); |
157 | 314 | 316 | ||
159 | 315 | this.screen.get_monitor_geometry(settings.monitor, out this.monitor_rec); | 317 | this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec); |
160 | 318 | var _scale = screen.get_monitor_scale_factor (settings.monitor); | ||
161 | 316 | 319 | ||
166 | 317 | settings.sx = this.monitor_rec.x; | 320 | settings.sx = this.monitor_rec.x * _scale; |
167 | 318 | settings.sy = this.monitor_rec.y; | 321 | settings.sy = this.monitor_rec.y * _scale; |
168 | 319 | settings.ex = settings.sx + this.monitor_rec.width - 1; | 322 | settings.ex = settings.sx + this.monitor_rec.width * _scale - 1; |
169 | 320 | settings.ey = settings.sy + this.monitor_rec.height - 1; | 323 | settings.ey = settings.sy + this.monitor_rec.height * _scale - 1; |
170 | 321 | }); | 324 | }); |
171 | 322 | 325 | ||
172 | 323 | settings.monitor = int.parse (monitors_combo.active_id); | 326 | settings.monitor = int.parse (monitors_combo.active_id); |
173 | 324 | 327 | ||
174 | 325 | this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec); | 328 | this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec); |
175 | 329 | scale = screen.get_monitor_scale_factor (settings.monitor); | ||
176 | 326 | 330 | ||
181 | 327 | settings.sx = this.monitor_rec.x; | 331 | settings.sx = this.monitor_rec.x * scale; |
182 | 328 | settings.sy = this.monitor_rec.y; | 332 | settings.sy = this.monitor_rec.y * scale; |
183 | 329 | settings.ex = settings.sx + this.monitor_rec.width - 1; | 333 | settings.ex = settings.sx + this.monitor_rec.width * scale - 1; |
184 | 330 | settings.ey = settings.sy + this.monitor_rec.height - 1; | 334 | settings.ey = settings.sy + this.monitor_rec.height * scale - 1; |
185 | 331 | 335 | ||
186 | 332 | recordingarea_combo.changed.connect (() => { | 336 | recordingarea_combo.changed.connect (() => { |
187 | 333 | if (recordingarea_combo.active_id != "full"){ | 337 | if (recordingarea_combo.active_id != "full"){ |
188 | @@ -359,11 +363,12 @@ | |||
189 | 359 | settings.monitor = int.parse (monitors_combo.active_id); | 363 | settings.monitor = int.parse (monitors_combo.active_id); |
190 | 360 | 364 | ||
191 | 361 | this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec); | 365 | this.screen.get_monitor_geometry (settings.monitor, out this.monitor_rec); |
192 | 366 | var _scale = screen.get_monitor_scale_factor (settings.monitor); | ||
193 | 362 | 367 | ||
198 | 363 | settings.sx = this.monitor_rec.x; | 368 | settings.sx = this.monitor_rec.x * _scale; |
199 | 364 | settings.sy = this.monitor_rec.y; | 369 | settings.sy = this.monitor_rec.y * _scale; |
200 | 365 | settings.ex = settings.sx + this.monitor_rec.width - 1; | 370 | settings.ex = settings.sx + this.monitor_rec.width * _scale - 1; |
201 | 366 | settings.ey = settings.sy + this.monitor_rec.height - 1; | 371 | settings.ey = settings.sy + this.monitor_rec.height * _scale - 1; |
202 | 367 | 372 | ||
203 | 368 | width.set_sensitive (false); | 373 | width.set_sensitive (false); |
204 | 369 | height.set_sensitive (false); | 374 | height.set_sensitive (false); |