Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~tintou/gala/hidpi | ||||
Merge into: | lp:gala | ||||
Diff against target: |
1163 lines (+626/-74) 13 files modified
data/Makefile.am (+2/-2) data/close.svg (+175/-0) lib/Utils.vala (+8/-6) lib/WindowManager.vala (+5/-0) plugins/notify/ConfirmationNotification.vala (+17/-8) plugins/notify/Main.vala (+3/-3) plugins/notify/Makefile.am (+1/-1) plugins/notify/NormalNotification.vala (+33/-14) plugins/notify/Notification.vala (+52/-25) plugins/notify/NotificationStack.vala (+8/-7) plugins/notify/NotifyServer.vala (+18/-8) plugins/notify/data/image-mask.svg (+235/-0) src/WindowManager.vala (+69/-0) |
||||
To merge this branch: | bzr merge lp:~tintou/gala/hidpi | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gala developers | Pending | ||
Review via email: mp+313508@code.launchpad.net |
Commit message
Description of the change
Enable HiDPI on the notifications
To post a comment you must log in.
lp:~tintou/gala/hidpi
updated
- 549. By Corentin Noël
-
[HiDPI] Notifications are now working
Revision history for this message
Rico Tzschichholz (ricotz) wrote : | # |
Unmerged revisions
- 549. By Corentin Noël
-
[HiDPI] Notifications are now working
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/Makefile.am' | |||
2 | --- data/Makefile.am 2016-07-14 20:04:44 +0000 | |||
3 | +++ data/Makefile.am 2016-12-18 21:20:25 +0000 | |||
4 | @@ -3,7 +3,7 @@ | |||
5 | 3 | $(NULL) | 3 | $(NULL) |
6 | 4 | 4 | ||
7 | 5 | stylesdir = $(pkgdatadir) | 5 | stylesdir = $(pkgdatadir) |
9 | 6 | styles_DATA = gala.css texture.png close.png | 6 | styles_DATA = gala.css texture.png close.svg |
10 | 7 | 7 | ||
11 | 8 | applicationsdir = $(datadir)/applications | 8 | applicationsdir = $(datadir)/applications |
12 | 9 | applications_DATA = gala.desktop gala-wayland.desktop gala-other.desktop gala-multitaskingview.desktop | 9 | applications_DATA = gala.desktop gala-wayland.desktop gala-other.desktop gala-multitaskingview.desktop |
13 | @@ -28,7 +28,7 @@ | |||
14 | 28 | gala-other.desktop.in \ | 28 | gala-other.desktop.in \ |
15 | 29 | gala-multitaskingview.desktop.in \ | 29 | gala-multitaskingview.desktop.in \ |
16 | 30 | texture.png \ | 30 | texture.png \ |
18 | 31 | close.png \ | 31 | close.svg \ |
19 | 32 | org.pantheon.desktop.gala.gschema.xml.in.in \ | 32 | org.pantheon.desktop.gala.gschema.xml.in.in \ |
20 | 33 | $(NULL) | 33 | $(NULL) |
21 | 34 | 34 | ||
22 | 35 | 35 | ||
23 | === removed file 'data/close.png' | |||
24 | 36 | Binary files data/close.png 2014-07-17 00:55:13 +0000 and data/close.png 1970-01-01 00:00:00 +0000 differ | 36 | Binary files data/close.png 2014-07-17 00:55:13 +0000 and data/close.png 1970-01-01 00:00:00 +0000 differ |
25 | === added file 'data/close.svg' | |||
26 | --- data/close.svg 1970-01-01 00:00:00 +0000 | |||
27 | +++ data/close.svg 2016-12-18 21:20:25 +0000 | |||
28 | @@ -0,0 +1,175 @@ | |||
29 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
30 | 2 | <svg | ||
31 | 3 | xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" | ||
32 | 4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
33 | 5 | xmlns:cc="http://creativecommons.org/ns#" | ||
34 | 6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
35 | 7 | xmlns:svg="http://www.w3.org/2000/svg" | ||
36 | 8 | xmlns="http://www.w3.org/2000/svg" | ||
37 | 9 | xmlns:xlink="http://www.w3.org/1999/xlink" | ||
38 | 10 | version="1.1" | ||
39 | 11 | id="svg2" | ||
40 | 12 | height="36" | ||
41 | 13 | width="36"> | ||
42 | 14 | <defs | ||
43 | 15 | id="defs4"> | ||
44 | 16 | <linearGradient | ||
45 | 17 | id="linearGradient5827"> | ||
46 | 18 | <stop | ||
47 | 19 | id="stop5829" | ||
48 | 20 | offset="0" | ||
49 | 21 | style="stop-color:#000000;stop-opacity:1;" /> | ||
50 | 22 | <stop | ||
51 | 23 | style="stop-color:#000000;stop-opacity:0.49411765;" | ||
52 | 24 | offset="0.80939096" | ||
53 | 25 | id="stop5835" /> | ||
54 | 26 | <stop | ||
55 | 27 | id="stop5831" | ||
56 | 28 | offset="1" | ||
57 | 29 | style="stop-color:#000000;stop-opacity:0;" /> | ||
58 | 30 | </linearGradient> | ||
59 | 31 | <linearGradient | ||
60 | 32 | id="linearGradient5714"> | ||
61 | 33 | <stop | ||
62 | 34 | id="stop5716" | ||
63 | 35 | offset="0" | ||
64 | 36 | style="stop-color:#000000;stop-opacity:0.79912664" /> | ||
65 | 37 | <stop | ||
66 | 38 | id="stop5718" | ||
67 | 39 | offset="1" | ||
68 | 40 | style="stop-color:#000000;stop-opacity:1" /> | ||
69 | 41 | </linearGradient> | ||
70 | 42 | <linearGradient | ||
71 | 43 | osb:paint="solid" | ||
72 | 44 | id="linearGradient8590"> | ||
73 | 45 | <stop | ||
74 | 46 | id="stop8592" | ||
75 | 47 | offset="0" | ||
76 | 48 | style="stop-color:#000000;stop-opacity:1;" /> | ||
77 | 49 | </linearGradient> | ||
78 | 50 | <linearGradient | ||
79 | 51 | id="linearGradient4011-28"> | ||
80 | 52 | <stop | ||
81 | 53 | id="stop4013-26" | ||
82 | 54 | style="stop-color:#ffffff;stop-opacity:1;" | ||
83 | 55 | offset="0" /> | ||
84 | 56 | <stop | ||
85 | 57 | offset="0.507761" | ||
86 | 58 | style="stop-color:#ffffff;stop-opacity:0.23529412;" | ||
87 | 59 | id="stop4015-7" /> | ||
88 | 60 | <stop | ||
89 | 61 | id="stop4017-0" | ||
90 | 62 | style="stop-color:#ffffff;stop-opacity:0.15686275;" | ||
91 | 63 | offset="0.83456558" /> | ||
92 | 64 | <stop | ||
93 | 65 | id="stop4019-9" | ||
94 | 66 | style="stop-color:#ffffff;stop-opacity:0.39215687;" | ||
95 | 67 | offset="1" /> | ||
96 | 68 | </linearGradient> | ||
97 | 69 | <linearGradient | ||
98 | 70 | id="linearGradient7232-8-8-68-3"> | ||
99 | 71 | <stop | ||
100 | 72 | id="stop7234-8-8-5-3" | ||
101 | 73 | style="stop-color:#7e7e7e;stop-opacity:1;" | ||
102 | 74 | offset="0" /> | ||
103 | 75 | <stop | ||
104 | 76 | id="stop7236-3-00-8-3" | ||
105 | 77 | style="stop-color:#3e3e3e;stop-opacity:1;" | ||
106 | 78 | offset="1" /> | ||
107 | 79 | </linearGradient> | ||
108 | 80 | <linearGradient | ||
109 | 81 | y2="607.51257" | ||
110 | 82 | x2="721.04901" | ||
111 | 83 | y1="583.98163" | ||
112 | 84 | x1="721.04901" | ||
113 | 85 | gradientTransform="matrix(0.47559079,0,0,1.454704,-230.86429,-383.79963)" | ||
114 | 86 | gradientUnits="userSpaceOnUse" | ||
115 | 87 | id="linearGradient5190" | ||
116 | 88 | xlink:href="#linearGradient7232-8-8-68-3" /> | ||
117 | 89 | <linearGradient | ||
118 | 90 | x1="71.204407" | ||
119 | 91 | y1="6.2375584" | ||
120 | 92 | x2="71.204407" | ||
121 | 93 | y2="44.340794" | ||
122 | 94 | id="linearGradient3089-9" | ||
123 | 95 | xlink:href="#linearGradient4011-28" | ||
124 | 96 | gradientUnits="userSpaceOnUse" | ||
125 | 97 | gradientTransform="matrix(0.78378373,0,0,0.78378373,52.776438,464.50041)" /> | ||
126 | 98 | <linearGradient | ||
127 | 99 | gradientUnits="userSpaceOnUse" | ||
128 | 100 | y2="500.487" | ||
129 | 101 | x2="109.62553" | ||
130 | 102 | y1="468.96909" | ||
131 | 103 | x1="109.62553" | ||
132 | 104 | id="linearGradient5720" | ||
133 | 105 | xlink:href="#linearGradient5714" /> | ||
134 | 106 | <radialGradient | ||
135 | 107 | gradientUnits="userSpaceOnUse" | ||
136 | 108 | r="18" | ||
137 | 109 | fy="485.375" | ||
138 | 110 | fx="109" | ||
139 | 111 | cy="485.375" | ||
140 | 112 | cx="109" | ||
141 | 113 | id="radialGradient5833" | ||
142 | 114 | xlink:href="#linearGradient5827" /> | ||
143 | 115 | <radialGradient | ||
144 | 116 | gradientTransform="matrix(0.94444444,0,0,0.94444444,6.0555566,25.965278)" | ||
145 | 117 | gradientUnits="userSpaceOnUse" | ||
146 | 118 | r="18" | ||
147 | 119 | fy="485.375" | ||
148 | 120 | fx="109" | ||
149 | 121 | cy="485.375" | ||
150 | 122 | cx="109" | ||
151 | 123 | id="radialGradient5833-9" | ||
152 | 124 | xlink:href="#linearGradient5827" /> | ||
153 | 125 | </defs> | ||
154 | 126 | <metadata | ||
155 | 127 | id="metadata7"> | ||
156 | 128 | <rdf:RDF> | ||
157 | 129 | <cc:Work | ||
158 | 130 | rdf:about=""> | ||
159 | 131 | <dc:format>image/svg+xml</dc:format> | ||
160 | 132 | <dc:type | ||
161 | 133 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
162 | 134 | <dc:title></dc:title> | ||
163 | 135 | </cc:Work> | ||
164 | 136 | </rdf:RDF> | ||
165 | 137 | </metadata> | ||
166 | 138 | <g | ||
167 | 139 | transform="translate(-91,-467.375)" | ||
168 | 140 | id="layer1"> | ||
169 | 141 | <path | ||
170 | 142 | d="m 109.00003,467.375 c -9.93187,0 -18.00003,8.06821 -18.00003,18 0,9.93179 8.06816,18 18.00003,18 9.93176,0 18,-8.06821 17.99997,-18 0,-9.93179 -8.06821,-18 -17.99997,-18 z" | ||
171 | 143 | id="path2555-7-1-4-4-8-6-5-1-0-2-9-5" | ||
172 | 144 | style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:url(#radialGradient5833);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999982;marker:none;enable-background:accumulate;opacity:0.7" /> | ||
173 | 145 | <path | ||
174 | 146 | d="m 109.00003,467.375 c -9.3801,0 -17.000029,7.61998 -17.000029,17 0,9.38002 7.619929,17 17.000029,17 9.37999,0 17,-7.61998 16.99997,-17 0,-9.38002 -7.61998,-17 -16.99997,-17 z" | ||
175 | 147 | id="path2555-7-1-4-4-8-6-5-1-0-2-9-5-9" | ||
176 | 148 | style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.7;fill:url(#radialGradient5833-9);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999982;marker:none;enable-background:accumulate" /> | ||
177 | 149 | <path | ||
178 | 150 | d="m 109.00002,469.375 c -8.27655,0 -15.000019,6.72351 -15.000019,15 0,8.27649 6.723469,15 15.000019,15 8.27647,0 15,-6.72351 14.99998,-15 0,-8.27649 -6.72351,-15 -14.99998,-15 z" | ||
179 | 151 | id="path2555-7-1-4-4-8-6-5-1-0-2-9" | ||
180 | 152 | style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:url(#linearGradient5190);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999982;marker:none;enable-background:accumulate" /> | ||
181 | 153 | <path | ||
182 | 154 | d="m 124.5,484.375 c 0,-8.56039 -6.9396,-15.5 -15.50007,-15.5 -8.5604,0 -15.499928,6.93961 -15.499928,15.5 0,8.56038 6.939528,15.5 15.499928,15.5 8.56047,0 15.50007,-6.93962 15.50007,-15.5 z" | ||
183 | 155 | id="path3019-2-0-4-7-1-46-65-2-0" | ||
184 | 156 | style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.6;fill:none;stroke:url(#linearGradient5720);stroke-width:0.99999988;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" /> | ||
185 | 157 | <path | ||
186 | 158 | style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.2;fill:none;stroke:url(#linearGradient3089-9);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" | ||
187 | 159 | id="path8655-2" | ||
188 | 160 | d="m 123.5,484.37448 c 0,8.0084 -6.49236,14.50052 -14.49983,14.50052 -8.00819,0 -14.50017,-6.4922 -14.50017,-14.50052 0,-8.00801 6.49198,-14.49948 14.50017,-14.49948 8.00747,0 14.49983,6.49147 14.49983,14.49948 l 0,0 z" /> | ||
189 | 161 | <path | ||
190 | 162 | d="m 104.58008,478.375 c -0.66357,0 -1.33178,0.26145 -1.83203,0.76172 -1.00181,1.00181 -1.0018,2.66225 0,3.66406 l 2.58789,2.58594 -2.58789,2.58789 c -1.00181,1.00181 -1.00181,2.66225 0,3.66406 1.00181,1.00181 2.66226,1.00183 3.66406,0 L 109,489.05078 l 2.58789,2.58789 c 1.0018,1.00184 2.66226,1.00183 3.66406,0 1.00183,-1.00181 1.00183,-2.66225 0,-3.66406 l -2.58789,-2.58789 2.58789,-2.58594 c 1.00181,-1.00181 1.00182,-2.66226 0,-3.66406 -1.0018,-1.00182 -2.66226,-1.00182 -3.66406,0 L 109,481.72461 l -2.58789,-2.58789 c -0.50025,-0.50026 -1.16846,-0.76172 -1.83203,-0.76172 z" | ||
191 | 163 | id="path5787" | ||
192 | 164 | style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.05;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;filter-blend-mode:normal;filter-gaussianBlur-deviation:0" /> | ||
193 | 165 | <path | ||
194 | 166 | id="rect5962-1" | ||
195 | 167 | d="m 104.58008,479.4669 c -0.38343,0 -0.76675,0.1476 -1.06055,0.44141 -0.5876,0.5876 -0.5876,1.53348 0,2.12109 l 3.35938,3.35742 -3.35938,3.35938 c -0.5876,0.5876 -0.5876,1.53349 0,2.12109 0.58761,0.58761 1.53349,0.58761 2.12109,0 L 109,487.50792 l 3.35938,3.35937 c 0.5876,0.58761 1.53349,0.58761 2.12109,0 0.58761,-0.5876 0.58761,-1.53349 0,-2.12109 l -3.35938,-3.35938 3.35938,-3.35742 c 0.58761,-0.58761 0.58761,-1.53349 0,-2.12109 -0.5876,-0.58761 -1.53349,-0.58761 -2.12109,0 L 109,483.26768 l -3.35938,-3.35937 c -0.2938,-0.29381 -0.67711,-0.44141 -1.06054,-0.44141 z" | ||
196 | 168 | style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.15;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;enable-background:accumulate;clip-rule:nonzero;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter-blend-mode:normal;filter-gaussianBlur-deviation:0;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto" /> | ||
197 | 169 | <path | ||
198 | 170 | transform="translate(91,467.375)" | ||
199 | 171 | id="rect5962" | ||
200 | 172 | d="M 13.580078 11.091797 C 13.196649 11.091797 12.813334 11.2394 12.519531 11.533203 C 11.931926 12.120809 11.931926 13.066691 12.519531 13.654297 L 15.878906 17.011719 L 12.519531 20.371094 C 11.931926 20.958699 11.931926 21.904582 12.519531 22.492188 C 13.107137 23.079793 14.053019 23.079793 14.640625 22.492188 L 18 19.132812 L 21.359375 22.492188 C 21.946981 23.079793 22.892863 23.079793 23.480469 22.492188 C 24.068074 21.904582 24.068074 20.958699 23.480469 20.371094 L 20.121094 17.011719 L 23.480469 13.654297 C 24.068074 13.066691 24.068074 12.120809 23.480469 11.533203 C 22.892863 10.945597 21.946981 10.945597 21.359375 11.533203 L 18 14.892578 L 14.640625 11.533203 C 14.346822 11.2394 13.963507 11.091797 13.580078 11.091797 z " | ||
201 | 173 | style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;enable-background:accumulate" /> | ||
202 | 174 | </g> | ||
203 | 175 | </svg> | ||
204 | 0 | 176 | ||
205 | === modified file 'lib/Utils.vala' | |||
206 | --- lib/Utils.vala 2016-11-15 16:13:39 +0000 | |||
207 | +++ lib/Utils.vala 2016-12-18 21:20:25 +0000 | |||
208 | @@ -25,6 +25,7 @@ | |||
209 | 25 | static uint cache_clear_timeout = 0; | 25 | static uint cache_clear_timeout = 0; |
210 | 26 | 26 | ||
211 | 27 | static Gdk.Pixbuf? close_pixbuf = null; | 27 | static Gdk.Pixbuf? close_pixbuf = null; |
212 | 28 | static int close_pixbuf_scale = 0; | ||
213 | 28 | 29 | ||
214 | 29 | static construct | 30 | static construct |
215 | 30 | { | 31 | { |
216 | @@ -290,11 +291,12 @@ | |||
217 | 290 | * | 291 | * |
218 | 291 | * @return the close button pixbuf or null if it failed to load | 292 | * @return the close button pixbuf or null if it failed to load |
219 | 292 | */ | 293 | */ |
221 | 293 | public static Gdk.Pixbuf? get_close_button_pixbuf () | 294 | public static Gdk.Pixbuf? get_close_button_pixbuf (int scale_factor) |
222 | 294 | { | 295 | { |
224 | 295 | if (close_pixbuf == null) { | 296 | if (close_pixbuf == null || close_pixbuf_scale != scale_factor) { |
225 | 296 | try { | 297 | try { |
227 | 297 | close_pixbuf = new Gdk.Pixbuf.from_file (Config.PKGDATADIR + "/close.png"); | 298 | close_pixbuf = new Gdk.Pixbuf.from_file_at_scale (Config.PKGDATADIR + "/close.svg", -1, 36 * scale_factor, true); |
228 | 299 | close_pixbuf_scale = scale_factor; | ||
229 | 298 | } catch (Error e) { | 300 | } catch (Error e) { |
230 | 299 | warning (e.message); | 301 | warning (e.message); |
231 | 300 | return null; | 302 | return null; |
232 | @@ -309,10 +311,10 @@ | |||
233 | 309 | * | 311 | * |
234 | 310 | * @return The close button actor | 312 | * @return The close button actor |
235 | 311 | */ | 313 | */ |
237 | 312 | public static Clutter.Actor create_close_button () | 314 | public static Clutter.Actor create_close_button (int scale_factor = 1) |
238 | 313 | { | 315 | { |
239 | 314 | var texture = new Clutter.Texture (); | 316 | var texture = new Clutter.Texture (); |
241 | 315 | var pixbuf = get_close_button_pixbuf (); | 317 | var pixbuf = get_close_button_pixbuf (scale_factor); |
242 | 316 | 318 | ||
243 | 317 | texture.reactive = true; | 319 | texture.reactive = true; |
244 | 318 | 320 | ||
245 | @@ -326,7 +328,7 @@ | |||
246 | 326 | // we'll just make this red so there's at least something as an | 328 | // we'll just make this red so there's at least something as an |
247 | 327 | // indicator that loading failed. Should never happen and this | 329 | // indicator that loading failed. Should never happen and this |
248 | 328 | // works as good as some weird fallback-image-failed-to-load pixbuf | 330 | // works as good as some weird fallback-image-failed-to-load pixbuf |
250 | 329 | texture.set_size (36, 36); | 331 | texture.set_size (36 * scale_factor, 36 * scale_factor); |
251 | 330 | texture.background_color = { 255, 0, 0, 255 }; | 332 | texture.background_color = { 255, 0, 0, 255 }; |
252 | 331 | } | 333 | } |
253 | 332 | 334 | ||
254 | 333 | 335 | ||
255 | === modified file 'lib/WindowManager.vala' | |||
256 | --- lib/WindowManager.vala 2015-03-04 11:07:30 +0000 | |||
257 | +++ lib/WindowManager.vala 2016-12-18 21:20:25 +0000 | |||
258 | @@ -92,6 +92,11 @@ | |||
259 | 92 | public abstract Meta.BackgroundGroup background_group { get; protected set; } | 92 | public abstract Meta.BackgroundGroup background_group { get; protected set; } |
260 | 93 | 93 | ||
261 | 94 | /** | 94 | /** |
262 | 95 | * The scale factor is the scale used by all user-facing elements | ||
263 | 96 | */ | ||
264 | 97 | public abstract int scale_factor { get; protected set; } | ||
265 | 98 | |||
266 | 99 | /** | ||
267 | 95 | * Enters the modal mode, which means that all events are directed to the stage instead | 100 | * Enters the modal mode, which means that all events are directed to the stage instead |
268 | 96 | * of the windows. This is the only way to receive keyboard events besides shortcut listeners. | 101 | * of the windows. This is the only way to receive keyboard events besides shortcut listeners. |
269 | 97 | * | 102 | * |
270 | 98 | 103 | ||
271 | === modified file 'plugins/notify/ConfirmationNotification.vala' | |||
272 | --- plugins/notify/ConfirmationNotification.vala 2014-07-21 01:21:19 +0000 | |||
273 | +++ plugins/notify/ConfirmationNotification.vala 2016-12-18 21:20:25 +0000 | |||
274 | @@ -55,7 +55,7 @@ | |||
275 | 55 | 55 | ||
276 | 56 | public override void update_allocation (out float content_height, AllocationFlags flags) | 56 | public override void update_allocation (out float content_height, AllocationFlags flags) |
277 | 57 | { | 57 | { |
279 | 58 | content_height = ICON_SIZE; | 58 | content_height = ICON_SIZE * style_context.get_scale (); |
280 | 59 | } | 59 | } |
281 | 60 | 60 | ||
282 | 61 | public override void draw_content (Cairo.Context cr) | 61 | public override void draw_content (Cairo.Context cr) |
283 | @@ -63,14 +63,21 @@ | |||
284 | 63 | if (!has_progress) | 63 | if (!has_progress) |
285 | 64 | return; | 64 | return; |
286 | 65 | 65 | ||
290 | 66 | var x = MARGIN + PADDING + ICON_SIZE + SPACING; | 66 | var scale = style_context.get_scale (); |
291 | 67 | var y = MARGIN + PADDING + (ICON_SIZE - PROGRESS_HEIGHT) / 2; | 67 | var scaled_width = WIDTH * scale; |
292 | 68 | var width = WIDTH - x - MARGIN; | 68 | var scaled_margin = MARGIN * scale; |
293 | 69 | var scaled_padding = PADDING * scale; | ||
294 | 70 | var scaled_icon_size = ICON_SIZE * scale; | ||
295 | 71 | var scaled_spacing = SPACING * scale; | ||
296 | 72 | var scaled_progress_height = PROGRESS_HEIGHT * scale; | ||
297 | 73 | var x = scaled_margin + scaled_padding + scaled_icon_size + scaled_spacing; | ||
298 | 74 | var y = scaled_margin + scaled_padding + (scaled_icon_size - scaled_progress_height) / 2; | ||
299 | 75 | var width = scaled_width - x - scaled_margin; | ||
300 | 69 | 76 | ||
301 | 70 | if (!transitioning) | 77 | if (!transitioning) |
302 | 71 | draw_progress_bar (cr, x, y, width, progress); | 78 | draw_progress_bar (cr, x, y, width, progress); |
303 | 72 | else { | 79 | else { |
305 | 73 | Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, MARGIN, MARGIN, WIDTH - MARGIN * 2, ICON_SIZE + PADDING * 2, 4); | 80 | Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, scaled_margin, scaled_margin, scaled_width - scaled_margin * 2, scaled_icon_size + scaled_padding * 2, 4); |
306 | 74 | cr.clip (); | 81 | cr.clip (); |
307 | 75 | 82 | ||
308 | 76 | draw_progress_bar (cr, x, y + animation_slide_y_offset, width, old_progress); | 83 | draw_progress_bar (cr, x, y + animation_slide_y_offset, width, old_progress); |
309 | @@ -82,16 +89,18 @@ | |||
310 | 82 | 89 | ||
311 | 83 | void draw_progress_bar (Cairo.Context cr, int x, float y, int width, int progress) | 90 | void draw_progress_bar (Cairo.Context cr, int x, float y, int width, int progress) |
312 | 84 | { | 91 | { |
313 | 92 | var scale = style_context.get_scale (); | ||
314 | 85 | var fraction = (int) Math.floor (progress.clamp (0, 100) / 100.0 * width); | 93 | var fraction = (int) Math.floor (progress.clamp (0, 100) / 100.0 * width); |
315 | 86 | 94 | ||
316 | 95 | var scaled_height = PROGRESS_HEIGHT * scale; | ||
317 | 87 | Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, width, | 96 | Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, width, |
319 | 88 | PROGRESS_HEIGHT, PROGRESS_HEIGHT / 2); | 97 | scaled_height, scaled_height / 2); |
320 | 89 | cr.set_source_rgb (0.8, 0.8, 0.8); | 98 | cr.set_source_rgb (0.8, 0.8, 0.8); |
321 | 90 | cr.fill (); | 99 | cr.fill (); |
322 | 91 | 100 | ||
323 | 92 | if (progress > 0) { | 101 | if (progress > 0) { |
324 | 93 | Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, fraction, | 102 | Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, fraction, |
326 | 94 | PROGRESS_HEIGHT, PROGRESS_HEIGHT / 2); | 103 | scaled_height, scaled_height / 2); |
327 | 95 | cr.set_source_rgb (0.3, 0.3, 0.3); | 104 | cr.set_source_rgb (0.3, 0.3, 0.3); |
328 | 96 | cr.fill (); | 105 | cr.fill (); |
329 | 97 | } | 106 | } |
330 | @@ -111,7 +120,7 @@ | |||
331 | 111 | 120 | ||
332 | 112 | old_progress = this.progress; | 121 | old_progress = this.progress; |
333 | 113 | 122 | ||
335 | 114 | play_update_transition (ICON_SIZE + PADDING * 2); | 123 | play_update_transition ((ICON_SIZE + PADDING * 2) * style_context.get_scale ()); |
336 | 115 | } | 124 | } |
337 | 116 | 125 | ||
338 | 117 | if (this.icon_only != icon_only) { | 126 | if (this.icon_only != icon_only) { |
339 | 118 | 127 | ||
340 | === modified file 'plugins/notify/Main.vala' | |||
341 | --- plugins/notify/Main.vala 2014-07-18 11:12:31 +0000 | |||
342 | +++ plugins/notify/Main.vala 2016-12-18 21:20:25 +0000 | |||
343 | @@ -30,9 +30,8 @@ | |||
344 | 30 | public override void initialize (Gala.WindowManager wm) | 30 | public override void initialize (Gala.WindowManager wm) |
345 | 31 | { | 31 | { |
346 | 32 | this.wm = wm; | 32 | this.wm = wm; |
347 | 33 | var screen = wm.get_screen (); | ||
348 | 34 | 33 | ||
350 | 35 | stack = new NotificationStack (wm.get_screen ()); | 34 | stack = new NotificationStack (wm); |
351 | 36 | wm.ui_group.add_child (stack); | 35 | wm.ui_group.add_child (stack); |
352 | 37 | track_actor (stack); | 36 | track_actor (stack); |
353 | 38 | 37 | ||
354 | @@ -43,6 +42,7 @@ | |||
355 | 43 | server = new NotifyServer (stack); | 42 | server = new NotifyServer (stack); |
356 | 44 | 43 | ||
357 | 45 | update_position (); | 44 | update_position (); |
358 | 45 | unowned Meta.Screen screen = wm.get_screen (); | ||
359 | 46 | screen.monitors_changed.connect (update_position); | 46 | screen.monitors_changed.connect (update_position); |
360 | 47 | screen.workareas_changed.connect (update_position); | 47 | screen.workareas_changed.connect (update_position); |
361 | 48 | 48 | ||
362 | @@ -64,7 +64,7 @@ | |||
363 | 64 | 64 | ||
364 | 65 | void update_position () | 65 | void update_position () |
365 | 66 | { | 66 | { |
367 | 67 | var screen = wm.get_screen (); | 67 | unowned Meta.Screen screen = wm.get_screen (); |
368 | 68 | var primary = screen.get_primary_monitor (); | 68 | var primary = screen.get_primary_monitor (); |
369 | 69 | var area = screen.get_active_workspace ().get_work_area_for_monitor (primary); | 69 | var area = screen.get_active_workspace ().get_work_area_for_monitor (primary); |
370 | 70 | 70 | ||
371 | 71 | 71 | ||
372 | === modified file 'plugins/notify/Makefile.am' | |||
373 | --- plugins/notify/Makefile.am 2015-03-04 10:56:41 +0000 | |||
374 | +++ plugins/notify/Makefile.am 2016-12-18 21:20:25 +0000 | |||
375 | @@ -3,7 +3,7 @@ | |||
376 | 3 | VAPIDIR = $(top_srcdir)/vapi | 3 | VAPIDIR = $(top_srcdir)/vapi |
377 | 4 | 4 | ||
378 | 5 | imagedir = $(pkgdatadir) | 5 | imagedir = $(pkgdatadir) |
380 | 6 | dist_image_DATA = data/image-mask.png | 6 | dist_image_DATA = data/image-mask.svg |
381 | 7 | 7 | ||
382 | 8 | BUILT_SOURCES = libgala_notify_la_vala.stamp | 8 | BUILT_SOURCES = libgala_notify_la_vala.stamp |
383 | 9 | 9 | ||
384 | 10 | 10 | ||
385 | === modified file 'plugins/notify/NormalNotification.vala' | |||
386 | --- plugins/notify/NormalNotification.vala 2016-08-04 07:37:29 +0000 | |||
387 | +++ plugins/notify/NormalNotification.vala 2016-12-18 21:20:25 +0000 | |||
388 | @@ -38,6 +38,8 @@ | |||
389 | 38 | } catch (Error e) {} | 38 | } catch (Error e) {} |
390 | 39 | } | 39 | } |
391 | 40 | 40 | ||
392 | 41 | public unowned Gtk.StyleContext parent_style_context { get; construct; } | ||
393 | 42 | |||
394 | 41 | const int LABEL_SPACING = 2; | 43 | const int LABEL_SPACING = 2; |
395 | 42 | 44 | ||
396 | 43 | Text summary_label; | 45 | Text summary_label; |
397 | @@ -64,6 +66,7 @@ | |||
398 | 64 | var label_style_context = new Gtk.StyleContext (); | 66 | var label_style_context = new Gtk.StyleContext (); |
399 | 65 | label_style_context.add_provider (Notification.default_css, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK); | 67 | label_style_context.add_provider (Notification.default_css, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK); |
400 | 66 | label_style_context.set_path (style_path); | 68 | label_style_context.set_path (style_path); |
401 | 69 | label_style_context.set_parent (parent_style_context); | ||
402 | 67 | 70 | ||
403 | 68 | Gdk.RGBA color; | 71 | Gdk.RGBA color; |
404 | 69 | 72 | ||
405 | @@ -93,6 +96,11 @@ | |||
406 | 93 | add_child (body_label); | 96 | add_child (body_label); |
407 | 94 | } | 97 | } |
408 | 95 | 98 | ||
409 | 99 | public NormalNotificationContent (Gtk.StyleContext parent_style_context) | ||
410 | 100 | { | ||
411 | 101 | Object (parent_style_context: parent_style_context); | ||
412 | 102 | } | ||
413 | 103 | |||
414 | 96 | public void set_values (string summary, string body) | 104 | public void set_values (string summary, string body) |
415 | 97 | { | 105 | { |
416 | 98 | summary_label.set_markup ("<b>%s</b>".printf (fix_markup (summary))); | 106 | summary_label.set_markup ("<b>%s</b>".printf (fix_markup (summary))); |
417 | @@ -119,7 +127,7 @@ | |||
418 | 119 | summary_label.allocate (summary_alloc, flags); | 127 | summary_label.allocate (summary_alloc, flags); |
419 | 120 | 128 | ||
420 | 121 | var body_alloc = ActorBox (); | 129 | var body_alloc = ActorBox (); |
422 | 122 | body_alloc.set_origin (label_x, label_y + summary_height + LABEL_SPACING); | 130 | body_alloc.set_origin (label_x, label_y + summary_height + LABEL_SPACING * parent_style_context.get_scale ()); |
423 | 123 | body_alloc.set_size (label_width, body_height); | 131 | body_alloc.set_size (label_width, body_height); |
424 | 124 | body_label.allocate (body_alloc, flags); | 132 | body_label.allocate (body_alloc, flags); |
425 | 125 | 133 | ||
426 | @@ -129,16 +137,22 @@ | |||
427 | 129 | void get_allocation_values (out float label_x, out float label_width, out float summary_height, | 137 | void get_allocation_values (out float label_x, out float label_width, out float summary_height, |
428 | 130 | out float body_height, out float label_height, out float label_y) | 138 | out float body_height, out float label_height, out float label_y) |
429 | 131 | { | 139 | { |
431 | 132 | var height = Notification.ICON_SIZE; | 140 | var scale = parent_style_context.get_scale (); |
432 | 141 | var height = Notification.ICON_SIZE * scale; | ||
433 | 142 | var width = scale * Notification.WIDTH; | ||
434 | 143 | var margin = scale * Notification.MARGIN; | ||
435 | 144 | var padding = scale * Notification.PADDING; | ||
436 | 145 | var spacing = scale * Notification.SPACING; | ||
437 | 146 | var label_spacing = scale * LABEL_SPACING; | ||
438 | 133 | 147 | ||
441 | 134 | label_x = Notification.MARGIN + Notification.PADDING + height + Notification.SPACING; | 148 | label_x = margin + padding + height + spacing; |
442 | 135 | label_width = Notification.WIDTH - label_x - Notification.MARGIN - Notification.SPACING; | 149 | label_width = width - label_x - margin - spacing; |
443 | 136 | 150 | ||
444 | 137 | summary_label.get_preferred_height (label_width, null, out summary_height); | 151 | summary_label.get_preferred_height (label_width, null, out summary_height); |
445 | 138 | body_label.get_preferred_height (label_width, null, out body_height); | 152 | body_label.get_preferred_height (label_width, null, out body_height); |
446 | 139 | 153 | ||
449 | 140 | label_height = summary_height + LABEL_SPACING + body_height; | 154 | label_height = summary_height + label_spacing + body_height; |
450 | 141 | label_y = Notification.MARGIN + Notification.PADDING; | 155 | label_y = margin + padding; |
451 | 142 | // center | 156 | // center |
452 | 143 | if (label_height < height) { | 157 | if (label_height < height) { |
453 | 144 | label_y += (height - (int) label_height) / 2; | 158 | label_y += (height - (int) label_height) / 2; |
454 | @@ -168,13 +182,13 @@ | |||
455 | 168 | public string body { get; construct set; } | 182 | public string body { get; construct set; } |
456 | 169 | public uint32 sender_pid { get; construct; } | 183 | public uint32 sender_pid { get; construct; } |
457 | 170 | public string[] notification_actions { get; construct set; } | 184 | public string[] notification_actions { get; construct set; } |
459 | 171 | public Screen screen { get; construct; } | 185 | public unowned Gala.WindowManager wm { get; construct; } |
460 | 172 | 186 | ||
461 | 173 | Actor content_container; | 187 | Actor content_container; |
462 | 174 | NormalNotificationContent notification_content; | 188 | NormalNotificationContent notification_content; |
463 | 175 | NormalNotificationContent? old_notification_content = null; | 189 | NormalNotificationContent? old_notification_content = null; |
464 | 176 | 190 | ||
466 | 177 | public NormalNotification (Screen screen, uint32 id, string summary, string body, Gdk.Pixbuf? icon, | 191 | public NormalNotification (Gala.WindowManager wm, uint32 id, string summary, string body, Gdk.Pixbuf? icon, |
467 | 178 | NotificationUrgency urgency, int32 expire_timeout, uint32 pid, string[] actions) | 192 | NotificationUrgency urgency, int32 expire_timeout, uint32 pid, string[] actions) |
468 | 179 | { | 193 | { |
469 | 180 | Object ( | 194 | Object ( |
470 | @@ -182,7 +196,7 @@ | |||
471 | 182 | icon: icon, | 196 | icon: icon, |
472 | 183 | urgency: urgency, | 197 | urgency: urgency, |
473 | 184 | expire_timeout: expire_timeout, | 198 | expire_timeout: expire_timeout, |
475 | 185 | screen: screen, | 199 | wm: wm, |
476 | 186 | summary: summary, | 200 | summary: summary, |
477 | 187 | body: body, | 201 | body: body, |
478 | 188 | sender_pid: pid, | 202 | sender_pid: pid, |
479 | @@ -192,9 +206,10 @@ | |||
480 | 192 | 206 | ||
481 | 193 | construct | 207 | construct |
482 | 194 | { | 208 | { |
483 | 209 | set_scale_factor (wm.scale_factor); | ||
484 | 195 | content_container = new Actor (); | 210 | content_container = new Actor (); |
485 | 196 | 211 | ||
487 | 197 | notification_content = new NormalNotificationContent (); | 212 | notification_content = new NormalNotificationContent (style_context); |
488 | 198 | notification_content.set_values (summary, body); | 213 | notification_content.set_values (summary, body); |
489 | 199 | 214 | ||
490 | 200 | content_container.add_child (notification_content); | 215 | content_container.add_child (notification_content); |
491 | @@ -210,7 +225,7 @@ | |||
492 | 210 | if (old_notification_content != null) | 225 | if (old_notification_content != null) |
493 | 211 | old_notification_content.destroy (); | 226 | old_notification_content.destroy (); |
494 | 212 | 227 | ||
496 | 213 | old_notification_content = new NormalNotificationContent (); | 228 | old_notification_content = new NormalNotificationContent (style_context); |
497 | 214 | old_notification_content.set_values (this.summary, this.body); | 229 | old_notification_content.set_values (this.summary, this.body); |
498 | 215 | 230 | ||
499 | 216 | content_container.add_child (old_notification_content); | 231 | content_container.add_child (old_notification_content); |
500 | @@ -225,7 +240,7 @@ | |||
501 | 225 | 240 | ||
502 | 226 | content_height = float.max (content_height, old_content_height); | 241 | content_height = float.max (content_height, old_content_height); |
503 | 227 | 242 | ||
505 | 228 | play_update_transition (content_height + PADDING * 2); | 243 | play_update_transition (content_height + PADDING * 2 * style_context.get_scale ()); |
506 | 229 | 244 | ||
507 | 230 | get_transition ("switch").completed.connect (() => { | 245 | get_transition ("switch").completed.connect (() => { |
508 | 231 | if (old_notification_content != null) | 246 | if (old_notification_content != null) |
509 | @@ -257,8 +272,10 @@ | |||
510 | 257 | // the for_width is not needed in our implementation of get_preferred_height as we | 272 | // the for_width is not needed in our implementation of get_preferred_height as we |
511 | 258 | // assume a constant width | 273 | // assume a constant width |
512 | 259 | notification_content.get_preferred_height (0, null, out content_height); | 274 | notification_content.get_preferred_height (0, null, out content_height); |
513 | 275 | var scale = style_context.get_scale (); | ||
514 | 276 | var scaled_margin = MARGIN * scale; | ||
515 | 260 | 277 | ||
517 | 261 | content_container.set_clip (MARGIN, MARGIN, MARGIN * 2 + WIDTH, content_height + PADDING * 2); | 278 | content_container.set_clip (scaled_margin, scaled_margin, scaled_margin * 2 + WIDTH * scale, content_height + PADDING * 2 * scale); |
518 | 262 | } | 279 | } |
519 | 263 | 280 | ||
520 | 264 | public override void get_preferred_height (float for_width, out float min_height, out float nat_height) | 281 | public override void get_preferred_height (float for_width, out float min_height, out float nat_height) |
521 | @@ -266,7 +283,7 @@ | |||
522 | 266 | float content_height; | 283 | float content_height; |
523 | 267 | notification_content.get_preferred_height (for_width, null, out content_height); | 284 | notification_content.get_preferred_height (for_width, null, out content_height); |
524 | 268 | 285 | ||
526 | 269 | min_height = nat_height = content_height + (MARGIN + PADDING) * 2; | 286 | min_height = nat_height = content_height + ((MARGIN + PADDING) * 2) * style_context.get_scale (); |
527 | 270 | } | 287 | } |
528 | 271 | 288 | ||
529 | 272 | public override void activate () | 289 | public override void activate () |
530 | @@ -287,6 +304,7 @@ | |||
531 | 287 | unowned Meta.Window? window = get_window (); | 304 | unowned Meta.Window? window = get_window (); |
532 | 288 | if (window != null) { | 305 | if (window != null) { |
533 | 289 | unowned Meta.Workspace workspace = window.get_workspace (); | 306 | unowned Meta.Workspace workspace = window.get_workspace (); |
534 | 307 | unowned Meta.Screen screen = wm.get_screen (); | ||
535 | 290 | var time = screen.get_display ().get_current_time (); | 308 | var time = screen.get_display ().get_current_time (); |
536 | 291 | 309 | ||
537 | 292 | if (workspace != screen.get_active_workspace ()) | 310 | if (workspace != screen.get_active_workspace ()) |
538 | @@ -303,6 +321,7 @@ | |||
539 | 303 | if (sender_pid == 0) | 321 | if (sender_pid == 0) |
540 | 304 | return null; | 322 | return null; |
541 | 305 | 323 | ||
542 | 324 | unowned Meta.Screen screen = wm.get_screen (); | ||
543 | 306 | foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { | 325 | foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { |
544 | 307 | if (actor.is_destroyed ()) | 326 | if (actor.is_destroyed ()) |
545 | 308 | continue; | 327 | continue; |
546 | 309 | 328 | ||
547 | === modified file 'plugins/notify/Notification.vala' | |||
548 | --- plugins/notify/Notification.vala 2016-11-15 16:13:39 +0000 | |||
549 | +++ plugins/notify/Notification.vala 2016-12-18 21:20:25 +0000 | |||
550 | @@ -53,7 +53,7 @@ | |||
551 | 53 | 53 | ||
552 | 54 | Clutter.Actor close_button; | 54 | Clutter.Actor close_button; |
553 | 55 | 55 | ||
555 | 56 | Gtk.StyleContext style_context; | 56 | protected Gtk.StyleContext style_context { get; private set; } |
556 | 57 | 57 | ||
557 | 58 | uint remove_timeout = 0; | 58 | uint remove_timeout = 0; |
558 | 59 | 59 | ||
559 | @@ -99,20 +99,7 @@ | |||
560 | 99 | icon_container = new Actor (); | 99 | icon_container = new Actor (); |
561 | 100 | icon_container.add_child (icon_texture); | 100 | icon_container.add_child (icon_texture); |
562 | 101 | 101 | ||
563 | 102 | close_button = Utils.create_close_button (); | ||
564 | 103 | close_button.opacity = 0; | ||
565 | 104 | close_button.reactive = true; | ||
566 | 105 | close_button.set_easing_duration (300); | ||
567 | 106 | |||
568 | 107 | var close_click = new ClickAction (); | ||
569 | 108 | close_click.clicked.connect (() => { | ||
570 | 109 | closed (id, NotificationClosedReason.DISMISSED); | ||
571 | 110 | close (); | ||
572 | 111 | }); | ||
573 | 112 | close_button.add_action (close_click); | ||
574 | 113 | |||
575 | 114 | add_child (icon_container); | 102 | add_child (icon_container); |
576 | 115 | add_child (close_button); | ||
577 | 116 | 103 | ||
578 | 117 | if (default_css == null) { | 104 | if (default_css == null) { |
579 | 118 | default_css = new Gtk.CssProvider (); | 105 | default_css = new Gtk.CssProvider (); |
580 | @@ -132,6 +119,8 @@ | |||
581 | 132 | style_context.add_class ("gala-notification"); | 119 | style_context.add_class ("gala-notification"); |
582 | 133 | style_context.set_path (style_path); | 120 | style_context.set_path (style_path); |
583 | 134 | 121 | ||
584 | 122 | create_close_button (); | ||
585 | 123 | |||
586 | 135 | var label_style_path = style_path.copy (); | 124 | var label_style_path = style_path.copy (); |
587 | 136 | label_style_path.iter_add_class (1, "gala-notification"); | 125 | label_style_path.iter_add_class (1, "gala-notification"); |
588 | 137 | label_style_path.append_type (typeof (Gtk.Label)); | 126 | label_style_path.append_type (typeof (Gtk.Label)); |
589 | @@ -227,6 +216,26 @@ | |||
590 | 227 | destroy (); | 216 | destroy (); |
591 | 228 | } | 217 | } |
592 | 229 | 218 | ||
593 | 219 | void create_close_button () { | ||
594 | 220 | if (close_button != null) | ||
595 | 221 | { | ||
596 | 222 | close_button.destroy (); | ||
597 | 223 | } | ||
598 | 224 | |||
599 | 225 | close_button = Utils.create_close_button (style_context.get_scale ()); | ||
600 | 226 | close_button.opacity = 0; | ||
601 | 227 | close_button.reactive = true; | ||
602 | 228 | close_button.set_easing_duration (300); | ||
603 | 229 | |||
604 | 230 | var close_click = new ClickAction (); | ||
605 | 231 | close_click.clicked.connect (() => { | ||
606 | 232 | closed (id, NotificationClosedReason.DISMISSED); | ||
607 | 233 | close (); | ||
608 | 234 | }); | ||
609 | 235 | close_button.add_action (close_click); | ||
610 | 236 | add_child (close_button); | ||
611 | 237 | } | ||
612 | 238 | |||
613 | 230 | protected void update_base (Gdk.Pixbuf? icon, int32 expire_timeout) | 239 | protected void update_base (Gdk.Pixbuf? icon, int32 expire_timeout) |
614 | 231 | { | 240 | { |
615 | 232 | this.icon = icon; | 241 | this.icon = icon; |
616 | @@ -273,6 +282,16 @@ | |||
617 | 273 | } | 282 | } |
618 | 274 | } | 283 | } |
619 | 275 | 284 | ||
620 | 285 | public void set_scale_factor (int scale_factor) | ||
621 | 286 | { | ||
622 | 287 | style_context.set_scale (scale_factor); | ||
623 | 288 | width = (WIDTH + MARGIN * 2) * scale_factor; | ||
624 | 289 | create_close_button (); | ||
625 | 290 | if (content is Canvas) { | ||
626 | 291 | ((Canvas) content).set_scale_factor (scale_factor); | ||
627 | 292 | } | ||
628 | 293 | } | ||
629 | 294 | |||
630 | 276 | public override bool enter_event (CrossingEvent event) | 295 | public override bool enter_event (CrossingEvent event) |
631 | 277 | { | 296 | { |
632 | 278 | close_button.opacity = 255; | 297 | close_button.opacity = 255; |
633 | @@ -304,21 +323,26 @@ | |||
634 | 304 | 323 | ||
635 | 305 | public override void allocate (ActorBox box, AllocationFlags flags) | 324 | public override void allocate (ActorBox box, AllocationFlags flags) |
636 | 306 | { | 325 | { |
637 | 326 | var scale = style_context.get_scale (); | ||
638 | 327 | var scaled_width = WIDTH * scale; | ||
639 | 328 | var scaled_icon_size = ICON_SIZE * scale; | ||
640 | 329 | var scaled_margin = MARGIN * scale; | ||
641 | 330 | var scaled_padding = PADDING * scale; | ||
642 | 331 | var margin_padding = scaled_margin + scaled_padding; | ||
643 | 307 | var icon_alloc = ActorBox (); | 332 | var icon_alloc = ActorBox (); |
644 | 308 | 333 | ||
647 | 309 | icon_alloc.set_origin (icon_only ? (WIDTH - ICON_SIZE) / 2 : MARGIN + PADDING, MARGIN + PADDING); | 334 | icon_alloc.set_origin (icon_only ? (scaled_width - scaled_icon_size) / 2 : margin_padding, margin_padding); |
648 | 310 | icon_alloc.set_size (ICON_SIZE, ICON_SIZE); | 335 | icon_alloc.set_size (scaled_icon_size, scaled_icon_size); |
649 | 311 | icon_container.allocate (icon_alloc, flags); | 336 | icon_container.allocate (icon_alloc, flags); |
650 | 312 | 337 | ||
651 | 313 | var close_alloc = ActorBox (); | 338 | var close_alloc = ActorBox (); |
654 | 314 | close_alloc.set_origin (MARGIN + PADDING - close_button.width / 2, | 339 | close_alloc.set_origin (margin_padding - close_button.width / 2, margin_padding - close_button.height / 2); |
653 | 315 | MARGIN + PADDING - close_button.height / 2); | ||
655 | 316 | close_alloc.set_size (close_button.width, close_button.height); | 340 | close_alloc.set_size (close_button.width, close_button.height); |
656 | 317 | close_button.allocate (close_alloc, flags); | 341 | close_button.allocate (close_alloc, flags); |
657 | 318 | 342 | ||
658 | 319 | float content_height; | 343 | float content_height; |
659 | 320 | update_allocation (out content_height, flags); | 344 | update_allocation (out content_height, flags); |
661 | 321 | box.set_size (MARGIN * 2 + WIDTH, (MARGIN + PADDING) * 2 + content_height); | 345 | box.set_size (scaled_margin * 2 + scaled_width, margin_padding * 2 + content_height); |
662 | 322 | 346 | ||
663 | 323 | base.allocate (box, flags); | 347 | base.allocate (box, flags); |
664 | 324 | 348 | ||
665 | @@ -331,7 +355,7 @@ | |||
666 | 331 | 355 | ||
667 | 332 | public override void get_preferred_height (float for_width, out float min_height, out float nat_height) | 356 | public override void get_preferred_height (float for_width, out float min_height, out float nat_height) |
668 | 333 | { | 357 | { |
670 | 334 | min_height = nat_height = ICON_SIZE + (MARGIN + PADDING) * 2; | 358 | min_height = nat_height = (ICON_SIZE + (MARGIN + PADDING) * 2) * style_context.get_scale (); |
671 | 335 | } | 359 | } |
672 | 336 | 360 | ||
673 | 337 | protected void play_update_transition (float slide_height) | 361 | protected void play_update_transition (float slide_height) |
674 | @@ -346,7 +370,8 @@ | |||
675 | 346 | 370 | ||
676 | 347 | old_texture = new Clutter.Texture (); | 371 | old_texture = new Clutter.Texture (); |
677 | 348 | icon_container.add_child (old_texture); | 372 | icon_container.add_child (old_texture); |
679 | 349 | icon_container.set_clip (0, -PADDING, ICON_SIZE, ICON_SIZE + PADDING * 2); | 373 | var scale = style_context.get_scale (); |
680 | 374 | icon_container.set_clip (0, -PADDING * scale, ICON_SIZE * scale, (ICON_SIZE + PADDING * 2) * scale); | ||
681 | 350 | 375 | ||
682 | 351 | if (icon != null) { | 376 | if (icon != null) { |
683 | 352 | try { | 377 | try { |
684 | @@ -382,10 +407,12 @@ | |||
685 | 382 | { | 407 | { |
686 | 383 | var canvas = (Canvas) content; | 408 | var canvas = (Canvas) content; |
687 | 384 | 409 | ||
692 | 385 | var x = MARGIN; | 410 | var scale = style_context.get_scale (); |
693 | 386 | var y = MARGIN; | 411 | var margin_scaled = MARGIN * scale; |
694 | 387 | var width = canvas.width - MARGIN * 2; | 412 | var x = margin_scaled; |
695 | 388 | var height = canvas.height - MARGIN * 2; | 413 | var y = margin_scaled; |
696 | 414 | var width = canvas.width - margin_scaled * 2; | ||
697 | 415 | var height = canvas.height - margin_scaled * 2; | ||
698 | 389 | cr.set_operator (Cairo.Operator.CLEAR); | 416 | cr.set_operator (Cairo.Operator.CLEAR); |
699 | 390 | cr.paint (); | 417 | cr.paint (); |
700 | 391 | cr.set_operator (Cairo.Operator.OVER); | 418 | cr.set_operator (Cairo.Operator.OVER); |
701 | 392 | 419 | ||
702 | === modified file 'plugins/notify/NotificationStack.vala' | |||
703 | --- plugins/notify/NotificationStack.vala 2016-07-28 22:19:16 +0000 | |||
704 | +++ plugins/notify/NotificationStack.vala 2016-12-18 21:20:25 +0000 | |||
705 | @@ -29,16 +29,16 @@ | |||
706 | 29 | 29 | ||
707 | 30 | public signal void animations_changed (bool running); | 30 | public signal void animations_changed (bool running); |
708 | 31 | 31 | ||
710 | 32 | public Screen screen { get; construct; } | 32 | public unowned Gala.WindowManager wm { get; construct; } |
711 | 33 | 33 | ||
713 | 34 | public NotificationStack (Screen screen) | 34 | public NotificationStack (Gala.WindowManager wm) |
714 | 35 | { | 35 | { |
716 | 36 | Object (screen: screen); | 36 | Object (wm: wm); |
717 | 37 | } | 37 | } |
718 | 38 | 38 | ||
719 | 39 | construct | 39 | construct |
720 | 40 | { | 40 | { |
722 | 41 | width = Notification.WIDTH + 2 * Notification.MARGIN + ADDITIONAL_MARGIN; | 41 | width = (Notification.WIDTH + 2 * Notification.MARGIN + ADDITIONAL_MARGIN) * wm.scale_factor; |
723 | 42 | clip_to_allocation = true; | 42 | clip_to_allocation = true; |
724 | 43 | } | 43 | } |
725 | 44 | 44 | ||
726 | @@ -67,16 +67,17 @@ | |||
727 | 67 | }); | 67 | }); |
728 | 68 | 68 | ||
729 | 69 | float height; | 69 | float height; |
731 | 70 | notification.get_preferred_height (Notification.WIDTH, out height, null); | 70 | int scale_factor = wm.scale_factor; |
732 | 71 | notification.get_preferred_height (Notification.WIDTH * scale_factor, out height, null); | ||
733 | 71 | update_positions (height); | 72 | update_positions (height); |
734 | 72 | 73 | ||
736 | 73 | notification.y = TOP_OFFSET; | 74 | notification.y = TOP_OFFSET * scale_factor; |
737 | 74 | insert_child_at_index (notification, 0); | 75 | insert_child_at_index (notification, 0); |
738 | 75 | } | 76 | } |
739 | 76 | 77 | ||
740 | 77 | void update_positions (float add_y = 0.0f) | 78 | void update_positions (float add_y = 0.0f) |
741 | 78 | { | 79 | { |
743 | 79 | var y = add_y + TOP_OFFSET; | 80 | var y = add_y + TOP_OFFSET * wm.scale_factor; |
744 | 80 | var i = get_n_children (); | 81 | var i = get_n_children (); |
745 | 81 | var delay_step = i > 0 ? 150 / i : 0; | 82 | var delay_step = i > 0 ? 150 / i : 0; |
746 | 82 | foreach (var child in get_children ()) { | 83 | foreach (var child in get_children ()) { |
747 | 83 | 84 | ||
748 | === modified file 'plugins/notify/NotifyServer.vala' | |||
749 | --- plugins/notify/NotifyServer.vala 2016-08-21 13:43:54 +0000 | |||
750 | +++ plugins/notify/NotifyServer.vala 2016-12-18 21:20:25 +0000 | |||
751 | @@ -52,6 +52,7 @@ | |||
752 | 52 | const string FALLBACK_APP_ID = "gala-other"; | 52 | const string FALLBACK_APP_ID = "gala-other"; |
753 | 53 | 53 | ||
754 | 54 | static Gdk.RGBA? icon_fg_color = null; | 54 | static Gdk.RGBA? icon_fg_color = null; |
755 | 55 | static Gdk.Pixbuf image_mask_pixbuf = null; | ||
756 | 55 | 56 | ||
757 | 56 | [DBus (visible = false)] | 57 | [DBus (visible = false)] |
758 | 57 | public signal void show_notification (Notification notification); | 58 | public signal void show_notification (Notification notification); |
759 | @@ -169,7 +170,8 @@ | |||
760 | 169 | icon = app_info.get_icon ().to_string (); | 170 | icon = app_info.get_icon ().to_string (); |
761 | 170 | 171 | ||
762 | 171 | var id = (replaces_id != 0 ? replaces_id : ++id_counter); | 172 | var id = (replaces_id != 0 ? replaces_id : ++id_counter); |
764 | 172 | var pixbuf = get_pixbuf (app_name, icon, hints); | 173 | unowned Gala.WindowManager wm = stack.wm; |
765 | 174 | var pixbuf = get_pixbuf (app_name, icon, hints, wm.scale_factor); | ||
766 | 173 | var timeout = (expire_timeout == uint32.MAX ? DEFAULT_TMEOUT : expire_timeout); | 175 | var timeout = (expire_timeout == uint32.MAX ? DEFAULT_TMEOUT : expire_timeout); |
767 | 174 | 176 | ||
768 | 175 | var urgency = NotificationUrgency.NORMAL; | 177 | var urgency = NotificationUrgency.NORMAL; |
769 | @@ -284,9 +286,10 @@ | |||
770 | 284 | progress ? hints.@get ("value").get_int32 () : -1, | 286 | progress ? hints.@get ("value").get_int32 () : -1, |
771 | 285 | hints.@get (X_CANONICAL_PRIVATE_SYNCHRONOUS).get_string ()); | 287 | hints.@get (X_CANONICAL_PRIVATE_SYNCHRONOUS).get_string ()); |
772 | 286 | else | 288 | else |
774 | 287 | notification = new NormalNotification (stack.screen, id, summary, body, pixbuf, | 289 | notification = new NormalNotification (wm, id, summary, body, pixbuf, |
775 | 288 | urgency, timeout, pid, actions); | 290 | urgency, timeout, pid, actions); |
776 | 289 | 291 | ||
777 | 292 | notification.set_scale_factor (wm.scale_factor); | ||
778 | 290 | notification.action_invoked.connect (notification_action_invoked_callback); | 293 | notification.action_invoked.connect (notification_action_invoked_callback); |
779 | 291 | notification.closed.connect (notification_closed_callback); | 294 | notification.closed.connect (notification_closed_callback); |
780 | 292 | stack.show_notification (notification); | 295 | stack.show_notification (notification); |
781 | @@ -325,7 +328,7 @@ | |||
782 | 325 | return icon_fg_color; | 328 | return icon_fg_color; |
783 | 326 | } | 329 | } |
784 | 327 | 330 | ||
786 | 328 | static Gdk.Pixbuf? get_pixbuf (string app_name, string app_icon, HashTable<string, Variant> hints) | 331 | static Gdk.Pixbuf? get_pixbuf (string app_name, string app_icon, HashTable<string, Variant> hints, int scale_factor) |
787 | 329 | { | 332 | { |
788 | 330 | // decide on the icon, order: | 333 | // decide on the icon, order: |
789 | 331 | // - image-data | 334 | // - image-data |
790 | @@ -337,8 +340,8 @@ | |||
791 | 337 | 340 | ||
792 | 338 | Gdk.Pixbuf? pixbuf = null; | 341 | Gdk.Pixbuf? pixbuf = null; |
793 | 339 | Variant? variant = null; | 342 | Variant? variant = null; |
796 | 340 | var size = Notification.ICON_SIZE; | 343 | var size = Notification.ICON_SIZE * scale_factor; |
797 | 341 | var mask_offset = 4; | 344 | var mask_offset = 4 * scale_factor; |
798 | 342 | var mask_size_offset = mask_offset * 2; | 345 | var mask_size_offset = mask_offset * 2; |
799 | 343 | var has_mask = false; | 346 | var has_mask = false; |
800 | 344 | 347 | ||
801 | @@ -402,7 +405,7 @@ | |||
802 | 402 | } catch (Error e) { warning (e.message); } | 405 | } catch (Error e) { warning (e.message); } |
803 | 403 | } | 406 | } |
804 | 404 | } else if (has_mask) { | 407 | } else if (has_mask) { |
806 | 405 | var mask_size = Notification.ICON_SIZE; | 408 | var mask_size = Notification.ICON_SIZE * scale_factor; |
807 | 406 | var offset_x = mask_offset; | 409 | var offset_x = mask_offset; |
808 | 407 | var offset_y = mask_offset + 1; | 410 | var offset_y = mask_offset + 1; |
809 | 408 | 411 | ||
810 | @@ -418,8 +421,15 @@ | |||
811 | 418 | 421 | ||
812 | 419 | cr.reset_clip (); | 422 | cr.reset_clip (); |
813 | 420 | 423 | ||
816 | 421 | var mask = new Cairo.ImageSurface.from_png (Config.PKGDATADIR + "/image-mask.png"); | 424 | if (image_mask_pixbuf == null) { |
817 | 422 | cr.set_source_surface (mask, 0, 0); | 425 | try { |
818 | 426 | image_mask_pixbuf = new Gdk.Pixbuf.from_file_at_scale (Config.PKGDATADIR + "/image-mask.svg", -1, 48 * scale_factor, true); | ||
819 | 427 | } catch (Error e) { | ||
820 | 428 | warning (e.message); | ||
821 | 429 | } | ||
822 | 430 | } | ||
823 | 431 | |||
824 | 432 | Gdk.cairo_set_source_pixbuf (cr, image_mask_pixbuf, 0, 0); | ||
825 | 423 | cr.paint (); | 433 | cr.paint (); |
826 | 424 | 434 | ||
827 | 425 | pixbuf = Gdk.pixbuf_get_from_surface (surface, 0, 0, mask_size, mask_size); | 435 | pixbuf = Gdk.pixbuf_get_from_surface (surface, 0, 0, mask_size, mask_size); |
828 | 426 | 436 | ||
829 | === removed file 'plugins/notify/data/image-mask.png' | |||
830 | 427 | Binary files plugins/notify/data/image-mask.png 2014-07-20 19:01:52 +0000 and plugins/notify/data/image-mask.png 1970-01-01 00:00:00 +0000 differ | 437 | Binary files plugins/notify/data/image-mask.png 2014-07-20 19:01:52 +0000 and plugins/notify/data/image-mask.png 1970-01-01 00:00:00 +0000 differ |
831 | === added file 'plugins/notify/data/image-mask.svg' | |||
832 | --- plugins/notify/data/image-mask.svg 1970-01-01 00:00:00 +0000 | |||
833 | +++ plugins/notify/data/image-mask.svg 2016-12-18 21:20:25 +0000 | |||
834 | @@ -0,0 +1,235 @@ | |||
835 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
836 | 2 | <svg | ||
837 | 3 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
838 | 4 | xmlns:cc="http://creativecommons.org/ns#" | ||
839 | 5 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
840 | 6 | xmlns:svg="http://www.w3.org/2000/svg" | ||
841 | 7 | xmlns="http://www.w3.org/2000/svg" | ||
842 | 8 | xmlns:xlink="http://www.w3.org/1999/xlink" | ||
843 | 9 | width="48" | ||
844 | 10 | height="48" | ||
845 | 11 | id="svg2" | ||
846 | 12 | version="1.1"> | ||
847 | 13 | <defs | ||
848 | 14 | id="defs4"> | ||
849 | 15 | <linearGradient | ||
850 | 16 | x1="45.447727" | ||
851 | 17 | y1="92.539597" | ||
852 | 18 | x2="45.447727" | ||
853 | 19 | y2="7.0165396" | ||
854 | 20 | id="ButtonShadow-9" | ||
855 | 21 | gradientUnits="userSpaceOnUse" | ||
856 | 22 | gradientTransform="scale(1.0058652,0.994169)"> | ||
857 | 23 | <stop | ||
858 | 24 | id="stop3750-3" | ||
859 | 25 | style="stop-color:#000000;stop-opacity:1" | ||
860 | 26 | offset="0" /> | ||
861 | 27 | <stop | ||
862 | 28 | id="stop3752-1" | ||
863 | 29 | style="stop-color:#000000;stop-opacity:0.58823532" | ||
864 | 30 | offset="1" /> | ||
865 | 31 | </linearGradient> | ||
866 | 32 | <filter | ||
867 | 33 | id="filter3174-4" | ||
868 | 34 | style="color-interpolation-filters:sRGB"> | ||
869 | 35 | <feGaussianBlur | ||
870 | 36 | id="feGaussianBlur3176-5" | ||
871 | 37 | stdDeviation="1.71" /> | ||
872 | 38 | </filter> | ||
873 | 39 | <linearGradient | ||
874 | 40 | x1="45.447727" | ||
875 | 41 | y1="92.539597" | ||
876 | 42 | x2="45.447727" | ||
877 | 43 | y2="7.0165396" | ||
878 | 44 | id="ButtonShadow" | ||
879 | 45 | gradientUnits="userSpaceOnUse" | ||
880 | 46 | gradientTransform="scale(1.0058652,0.994169)"> | ||
881 | 47 | <stop | ||
882 | 48 | id="stop3750-9" | ||
883 | 49 | style="stop-color:#000000;stop-opacity:1" | ||
884 | 50 | offset="0" /> | ||
885 | 51 | <stop | ||
886 | 52 | id="stop3752-7" | ||
887 | 53 | style="stop-color:#000000;stop-opacity:0.58823532" | ||
888 | 54 | offset="1" /> | ||
889 | 55 | </linearGradient> | ||
890 | 56 | <filter | ||
891 | 57 | id="filter3174" | ||
892 | 58 | style="color-interpolation-filters:sRGB"> | ||
893 | 59 | <feGaussianBlur | ||
894 | 60 | id="feGaussianBlur3176" | ||
895 | 61 | stdDeviation="1.71" /> | ||
896 | 62 | </filter> | ||
897 | 63 | <linearGradient | ||
898 | 64 | xlink:href="#ButtonShadow-9" | ||
899 | 65 | id="linearGradient6176" | ||
900 | 66 | gradientUnits="userSpaceOnUse" | ||
901 | 67 | gradientTransform="scale(1.0058652,0.994169)" | ||
902 | 68 | x1="45.447727" | ||
903 | 69 | y1="92.539597" | ||
904 | 70 | x2="45.447727" | ||
905 | 71 | y2="7.0165396" /> | ||
906 | 72 | <linearGradient | ||
907 | 73 | xlink:href="#ButtonShadow" | ||
908 | 74 | id="linearGradient6178" | ||
909 | 75 | gradientUnits="userSpaceOnUse" | ||
910 | 76 | gradientTransform="scale(1.0058652,0.994169)" | ||
911 | 77 | x1="45.447727" | ||
912 | 78 | y1="92.539597" | ||
913 | 79 | x2="45.447727" | ||
914 | 80 | y2="7.0165396" /> | ||
915 | 81 | <linearGradient | ||
916 | 82 | id="linearGradient3688-464-309-9-2-4-2"> | ||
917 | 83 | <stop | ||
918 | 84 | offset="0" | ||
919 | 85 | style="stop-color:#181818;stop-opacity:1" | ||
920 | 86 | id="stop2889-7-9-6-9" /> | ||
921 | 87 | <stop | ||
922 | 88 | offset="1" | ||
923 | 89 | style="stop-color:#181818;stop-opacity:0" | ||
924 | 90 | id="stop2891-6-6-1-7" /> | ||
925 | 91 | </linearGradient> | ||
926 | 92 | <linearGradient | ||
927 | 93 | id="linearGradient3702-501-757-8-4-1-1-9"> | ||
928 | 94 | <stop | ||
929 | 95 | offset="0" | ||
930 | 96 | style="stop-color:#181818;stop-opacity:0" | ||
931 | 97 | id="stop2895-8-9-9-1-4" /> | ||
932 | 98 | <stop | ||
933 | 99 | offset="0.5" | ||
934 | 100 | style="stop-color:#181818;stop-opacity:1" | ||
935 | 101 | id="stop2897-7-8-7-7-3" /> | ||
936 | 102 | <stop | ||
937 | 103 | offset="1" | ||
938 | 104 | style="stop-color:#181818;stop-opacity:0" | ||
939 | 105 | id="stop2899-4-5-1-5-6" /> | ||
940 | 106 | </linearGradient> | ||
941 | 107 | <linearGradient | ||
942 | 108 | gradientTransform="translate(0,1.0000172)" | ||
943 | 109 | gradientUnits="userSpaceOnUse" | ||
944 | 110 | xlink:href="#linearGradient3924-1-7-54" | ||
945 | 111 | id="linearGradient3028-82" | ||
946 | 112 | y2="41.978722" | ||
947 | 113 | x2="40" | ||
948 | 114 | y1="5.9999828" | ||
949 | 115 | x1="40" /> | ||
950 | 116 | <linearGradient | ||
951 | 117 | id="linearGradient3924-1-7-54"> | ||
952 | 118 | <stop | ||
953 | 119 | offset="0" | ||
954 | 120 | style="stop-color:#ffffff;stop-opacity:1" | ||
955 | 121 | id="stop3926-3-4-4" /> | ||
956 | 122 | <stop | ||
957 | 123 | offset="0.02779419" | ||
958 | 124 | style="stop-color:#ffffff;stop-opacity:0.23529412" | ||
959 | 125 | id="stop3928-91-41-8" /> | ||
960 | 126 | <stop | ||
961 | 127 | offset="0.97279674" | ||
962 | 128 | style="stop-color:#ffffff;stop-opacity:0.15686275" | ||
963 | 129 | id="stop3930-6-6-6" /> | ||
964 | 130 | <stop | ||
965 | 131 | offset="1" | ||
966 | 132 | style="stop-color:#ffffff;stop-opacity:0.39215687" | ||
967 | 133 | id="stop3932-6-6-7" /> | ||
968 | 134 | </linearGradient> | ||
969 | 135 | <linearGradient | ||
970 | 136 | gradientTransform="matrix(1.1578952,0,0,0.6428571,-3.78948,16.285716)" | ||
971 | 137 | gradientUnits="userSpaceOnUse" | ||
972 | 138 | xlink:href="#linearGradient3702-501-757-8-4-1-1-9" | ||
973 | 139 | id="linearGradient6084-5" | ||
974 | 140 | y2="39.999443" | ||
975 | 141 | x2="25.058096" | ||
976 | 142 | y1="47.027729" | ||
977 | 143 | x1="25.058096" /> | ||
978 | 144 | <radialGradient | ||
979 | 145 | gradientTransform="matrix(2.3201719,0,0,0.89999994,28.617841,5.100003)" | ||
980 | 146 | gradientUnits="userSpaceOnUse" | ||
981 | 147 | xlink:href="#linearGradient3688-464-309-9-2-4-2" | ||
982 | 148 | id="radialGradient3013-3-1" | ||
983 | 149 | fy="43.5" | ||
984 | 150 | fx="4.9929786" | ||
985 | 151 | r="2.5" | ||
986 | 152 | cy="43.5" | ||
987 | 153 | cx="4.9929786" /> | ||
988 | 154 | <radialGradient | ||
989 | 155 | gradientTransform="matrix(-2.3201719,0,0,0.89999994,19.382159,5.100003)" | ||
990 | 156 | gradientUnits="userSpaceOnUse" | ||
991 | 157 | xlink:href="#linearGradient3688-464-309-9-2-4-2" | ||
992 | 158 | id="radialGradient3013-3-1-8" | ||
993 | 159 | fy="43.5" | ||
994 | 160 | fx="4.9929786" | ||
995 | 161 | r="2.5" | ||
996 | 162 | cy="43.5" | ||
997 | 163 | cx="4.9929786" /> | ||
998 | 164 | </defs> | ||
999 | 165 | <metadata | ||
1000 | 166 | id="metadata7"> | ||
1001 | 167 | <rdf:RDF> | ||
1002 | 168 | <cc:Work | ||
1003 | 169 | rdf:about=""> | ||
1004 | 170 | <dc:format>image/svg+xml</dc:format> | ||
1005 | 171 | <dc:type | ||
1006 | 172 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
1007 | 173 | <dc:title></dc:title> | ||
1008 | 174 | </cc:Work> | ||
1009 | 175 | </rdf:RDF> | ||
1010 | 176 | </metadata> | ||
1011 | 177 | <path | ||
1012 | 178 | id="path10394" | ||
1013 | 179 | d="M 44 42 L 44 42.5 C 44 43.885 42.885 45 41.5 45 L 40.210938 45 L 40.210938 46.5 L 46 46.5 L 46 42 L 44 42 z " | ||
1014 | 180 | style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.3;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient3013-3-1);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;filter-blend-mode:normal;filter-gaussianBlur-deviation:0" /> | ||
1015 | 181 | <path | ||
1016 | 182 | id="rect3700-4" | ||
1017 | 183 | d="M 7.7890625 45 L 7.7890625 46.5 L 40.210938 46.5 L 40.210938 45 L 7.7890625 45 z " | ||
1018 | 184 | style="fill:url(#linearGradient6084-5);fill-opacity:1;stroke:none;color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.3;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill-rule:nonzero;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter-blend-mode:normal;filter-gaussianBlur-deviation:0;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" /> | ||
1019 | 185 | <g | ||
1020 | 186 | transform="translate(906.27272,-452.04544)" | ||
1021 | 187 | style="display:none" | ||
1022 | 188 | id="layer2"> | ||
1023 | 189 | <rect | ||
1024 | 190 | style="opacity:0.9;fill:url(#linearGradient6178);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3174)" | ||
1025 | 191 | id="rect3745" | ||
1026 | 192 | y="7" | ||
1027 | 193 | x="5" | ||
1028 | 194 | ry="6" | ||
1029 | 195 | rx="6" | ||
1030 | 196 | height="85" | ||
1031 | 197 | width="86" /> | ||
1032 | 198 | </g> | ||
1033 | 199 | <g | ||
1034 | 200 | transform="translate(903,-452.40908)" | ||
1035 | 201 | style="display:none" | ||
1036 | 202 | id="layer2-4"> | ||
1037 | 203 | <rect | ||
1038 | 204 | style="opacity:0.9;fill:url(#linearGradient6176);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3174-4)" | ||
1039 | 205 | id="rect3745-5" | ||
1040 | 206 | y="7" | ||
1041 | 207 | x="5" | ||
1042 | 208 | ry="6" | ||
1043 | 209 | rx="6" | ||
1044 | 210 | height="85" | ||
1045 | 211 | width="86" /> | ||
1046 | 212 | </g> | ||
1047 | 213 | <rect | ||
1048 | 214 | width="37" | ||
1049 | 215 | height="37" | ||
1050 | 216 | rx="1" | ||
1051 | 217 | ry="1" | ||
1052 | 218 | x="5.5" | ||
1053 | 219 | y="6.5" | ||
1054 | 220 | id="rect6741-11-6" | ||
1055 | 221 | style="opacity:0.4;fill:none;stroke:url(#linearGradient3028-82);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> | ||
1056 | 222 | <rect | ||
1057 | 223 | width="39" | ||
1058 | 224 | height="39" | ||
1059 | 225 | rx="2" | ||
1060 | 226 | ry="2" | ||
1061 | 227 | x="4.5" | ||
1062 | 228 | y="5.5" | ||
1063 | 229 | id="rect5505-21-3-2-7-4" | ||
1064 | 230 | style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.3;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" /> | ||
1065 | 231 | <path | ||
1066 | 232 | id="path10394-3" | ||
1067 | 233 | d="m 4,42 0,0.5 C 4,43.885 5.115,45 6.5,45 l 1.289062,0 0,1.5 L 2,46.5 2,42 4,42 Z" | ||
1068 | 234 | style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.3;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient3013-3-1-8);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" /> | ||
1069 | 235 | </svg> | ||
1070 | 0 | 236 | ||
1071 | === modified file 'src/WindowManager.vala' | |||
1072 | --- src/WindowManager.vala 2016-11-18 16:57:03 +0000 | |||
1073 | +++ src/WindowManager.vala 2016-12-18 21:20:25 +0000 | |||
1074 | @@ -68,6 +68,11 @@ | |||
1075 | 68 | */ | 68 | */ |
1076 | 69 | public Meta.BackgroundGroup background_group { get; protected set; } | 69 | public Meta.BackgroundGroup background_group { get; protected set; } |
1077 | 70 | 70 | ||
1078 | 71 | /** | ||
1079 | 72 | * {@inheritDoc} | ||
1080 | 73 | */ | ||
1081 | 74 | public int scale_factor { get; protected set; } | ||
1082 | 75 | |||
1083 | 71 | Meta.PluginInfo info; | 76 | Meta.PluginInfo info; |
1084 | 72 | 77 | ||
1085 | 73 | WindowSwitcher? winswitcher = null; | 78 | WindowSwitcher? winswitcher = null; |
1086 | @@ -144,6 +149,8 @@ | |||
1087 | 144 | WindowListener.init (screen); | 149 | WindowListener.init (screen); |
1088 | 145 | KeyboardManager.init (display); | 150 | KeyboardManager.init (display); |
1089 | 146 | 151 | ||
1090 | 152 | compute_scale_factor (); | ||
1091 | 153 | |||
1092 | 147 | // Due to a bug which enables access to the stage when using multiple monitors | 154 | // Due to a bug which enables access to the stage when using multiple monitors |
1093 | 148 | // in the screensaver, we have to listen for changes and make sure the input area | 155 | // in the screensaver, we have to listen for changes and make sure the input area |
1094 | 149 | // is set to NONE when we are in locked mode | 156 | // is set to NONE when we are in locked mode |
1095 | @@ -314,6 +321,68 @@ | |||
1096 | 314 | return false; | 321 | return false; |
1097 | 315 | } | 322 | } |
1098 | 316 | 323 | ||
1099 | 324 | /* DPI constants taken from gnome-settings-daemon/plugins/xsettings/gsd-xsettings-manager.c */ | ||
1100 | 325 | private const int DPI_FALLBACK = 96; | ||
1101 | 326 | /* The minimum resolution at which we turn on a window-scale of 2 */ | ||
1102 | 327 | private const int HIDPI_LIMIT = (DPI_FALLBACK * 2); | ||
1103 | 328 | /* The minimum screen height at which we turn on a window-scale of 2; | ||
1104 | 329 | * below this there just isn't enough vertical real estate for GNOME | ||
1105 | 330 | * apps to work, and it's better to just be tiny */ | ||
1106 | 331 | private const int HIDPI_MIN_HEIGHT = 1200; | ||
1107 | 332 | private const int SMALLEST_4K_WIDTH = 3656; | ||
1108 | 333 | |||
1109 | 334 | void compute_scale_factor () | ||
1110 | 335 | { | ||
1111 | 336 | var desktop_settings = new GLib.Settings ("org.gnome.desktop.interface"); | ||
1112 | 337 | var desktop_scale = desktop_settings.get_int ("scaling-factor"); | ||
1113 | 338 | if (desktop_scale > 0) { | ||
1114 | 339 | scale_factor = desktop_scale; | ||
1115 | 340 | } else { | ||
1116 | 341 | weak Gdk.Display? display = Gdk.Display.get_default (); | ||
1117 | 342 | weak Gdk.Screen screen = display.get_default_screen (); | ||
1118 | 343 | var primary = screen.get_primary_monitor (); | ||
1119 | 344 | var rect = Gdk.Rectangle (); | ||
1120 | 345 | screen.get_monitor_geometry (primary, out rect); | ||
1121 | 346 | var monitor_scale = screen.get_monitor_scale_factor (primary); | ||
1122 | 347 | |||
1123 | 348 | int width = rect.width * monitor_scale; | ||
1124 | 349 | int height = rect.height * monitor_scale; | ||
1125 | 350 | int width_mm = screen.get_monitor_width_mm (primary); | ||
1126 | 351 | int height_mm = screen.get_monitor_height_mm (primary); | ||
1127 | 352 | |||
1128 | 353 | if (height < HIDPI_MIN_HEIGHT) | ||
1129 | 354 | { | ||
1130 | 355 | scale_factor = 1; | ||
1131 | 356 | return; | ||
1132 | 357 | } | ||
1133 | 358 | |||
1134 | 359 | /* Somebody encoded the aspect ratio (16/9 or 16/10) | ||
1135 | 360 | * instead of the physical size */ | ||
1136 | 361 | if ((width_mm == 160 && height_mm == 90) || | ||
1137 | 362 | (width_mm == 160 && height_mm == 100) || | ||
1138 | 363 | (width_mm == 16 && height_mm == 9) || | ||
1139 | 364 | (width_mm == 16 && height_mm == 10)) | ||
1140 | 365 | { | ||
1141 | 366 | scale_factor = 1; | ||
1142 | 367 | return; | ||
1143 | 368 | } | ||
1144 | 369 | |||
1145 | 370 | if (width_mm > 0 && height_mm > 0) { | ||
1146 | 371 | var dpi_x = (double)width / (width_mm / 25.4); | ||
1147 | 372 | var dpi_y = (double)height / (height_mm / 25.4); | ||
1148 | 373 | /* We don't completely trust these values so both | ||
1149 | 374 | must be high, and never pick higher ratio than | ||
1150 | 375 | 2 automatically */ | ||
1151 | 376 | if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT) { | ||
1152 | 377 | scale_factor = 2; | ||
1153 | 378 | return; | ||
1154 | 379 | } | ||
1155 | 380 | } | ||
1156 | 381 | |||
1157 | 382 | scale_factor = 1; | ||
1158 | 383 | } | ||
1159 | 384 | } | ||
1160 | 385 | |||
1161 | 317 | void configure_hotcorners () | 386 | void configure_hotcorners () |
1162 | 318 | { | 387 | { |
1163 | 319 | var geometry = get_screen ().get_monitor_geometry (get_screen ().get_primary_monitor ()); | 388 | var geometry = get_screen ().get_monitor_geometry (get_screen ().get_primary_monitor ()); |
Please rebase on trunk