Merge lp:~tintou/gala/hidpi into lp:gala

Proposed by Corentin Noël
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
Reviewer Review Type Date Requested Status
Gala developers Pending
Review via email: mp+313508@code.launchpad.net

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 :

Please rebase on trunk

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
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2016-07-14 20:04:44 +0000
+++ data/Makefile.am 2016-12-18 21:20:25 +0000
@@ -3,7 +3,7 @@
3 $(NULL)3 $(NULL)
44
5stylesdir = $(pkgdatadir)5stylesdir = $(pkgdatadir)
6styles_DATA = gala.css texture.png close.png6styles_DATA = gala.css texture.png close.svg
77
8applicationsdir = $(datadir)/applications8applicationsdir = $(datadir)/applications
9applications_DATA = gala.desktop gala-wayland.desktop gala-other.desktop gala-multitaskingview.desktop9applications_DATA = gala.desktop gala-wayland.desktop gala-other.desktop gala-multitaskingview.desktop
@@ -28,7 +28,7 @@
28 gala-other.desktop.in \28 gala-other.desktop.in \
29 gala-multitaskingview.desktop.in \29 gala-multitaskingview.desktop.in \
30 texture.png \30 texture.png \
31 close.png \31 close.svg \
32 org.pantheon.desktop.gala.gschema.xml.in.in \32 org.pantheon.desktop.gala.gschema.xml.in.in \
33 $(NULL)33 $(NULL)
3434
3535
=== removed file 'data/close.png'
36Binary files data/close.png 2014-07-17 00:55:13 +0000 and data/close.png 1970-01-01 00:00:00 +0000 differ36Binary files data/close.png 2014-07-17 00:55:13 +0000 and data/close.png 1970-01-01 00:00:00 +0000 differ
=== added file 'data/close.svg'
--- data/close.svg 1970-01-01 00:00:00 +0000
+++ data/close.svg 2016-12-18 21:20:25 +0000
@@ -0,0 +1,175 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<svg
3 xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
4 xmlns:dc="http://purl.org/dc/elements/1.1/"
5 xmlns:cc="http://creativecommons.org/ns#"
6 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7 xmlns:svg="http://www.w3.org/2000/svg"
8 xmlns="http://www.w3.org/2000/svg"
9 xmlns:xlink="http://www.w3.org/1999/xlink"
10 version="1.1"
11 id="svg2"
12 height="36"
13 width="36">
14 <defs
15 id="defs4">
16 <linearGradient
17 id="linearGradient5827">
18 <stop
19 id="stop5829"
20 offset="0"
21 style="stop-color:#000000;stop-opacity:1;" />
22 <stop
23 style="stop-color:#000000;stop-opacity:0.49411765;"
24 offset="0.80939096"
25 id="stop5835" />
26 <stop
27 id="stop5831"
28 offset="1"
29 style="stop-color:#000000;stop-opacity:0;" />
30 </linearGradient>
31 <linearGradient
32 id="linearGradient5714">
33 <stop
34 id="stop5716"
35 offset="0"
36 style="stop-color:#000000;stop-opacity:0.79912664" />
37 <stop
38 id="stop5718"
39 offset="1"
40 style="stop-color:#000000;stop-opacity:1" />
41 </linearGradient>
42 <linearGradient
43 osb:paint="solid"
44 id="linearGradient8590">
45 <stop
46 id="stop8592"
47 offset="0"
48 style="stop-color:#000000;stop-opacity:1;" />
49 </linearGradient>
50 <linearGradient
51 id="linearGradient4011-28">
52 <stop
53 id="stop4013-26"
54 style="stop-color:#ffffff;stop-opacity:1;"
55 offset="0" />
56 <stop
57 offset="0.507761"
58 style="stop-color:#ffffff;stop-opacity:0.23529412;"
59 id="stop4015-7" />
60 <stop
61 id="stop4017-0"
62 style="stop-color:#ffffff;stop-opacity:0.15686275;"
63 offset="0.83456558" />
64 <stop
65 id="stop4019-9"
66 style="stop-color:#ffffff;stop-opacity:0.39215687;"
67 offset="1" />
68 </linearGradient>
69 <linearGradient
70 id="linearGradient7232-8-8-68-3">
71 <stop
72 id="stop7234-8-8-5-3"
73 style="stop-color:#7e7e7e;stop-opacity:1;"
74 offset="0" />
75 <stop
76 id="stop7236-3-00-8-3"
77 style="stop-color:#3e3e3e;stop-opacity:1;"
78 offset="1" />
79 </linearGradient>
80 <linearGradient
81 y2="607.51257"
82 x2="721.04901"
83 y1="583.98163"
84 x1="721.04901"
85 gradientTransform="matrix(0.47559079,0,0,1.454704,-230.86429,-383.79963)"
86 gradientUnits="userSpaceOnUse"
87 id="linearGradient5190"
88 xlink:href="#linearGradient7232-8-8-68-3" />
89 <linearGradient
90 x1="71.204407"
91 y1="6.2375584"
92 x2="71.204407"
93 y2="44.340794"
94 id="linearGradient3089-9"
95 xlink:href="#linearGradient4011-28"
96 gradientUnits="userSpaceOnUse"
97 gradientTransform="matrix(0.78378373,0,0,0.78378373,52.776438,464.50041)" />
98 <linearGradient
99 gradientUnits="userSpaceOnUse"
100 y2="500.487"
101 x2="109.62553"
102 y1="468.96909"
103 x1="109.62553"
104 id="linearGradient5720"
105 xlink:href="#linearGradient5714" />
106 <radialGradient
107 gradientUnits="userSpaceOnUse"
108 r="18"
109 fy="485.375"
110 fx="109"
111 cy="485.375"
112 cx="109"
113 id="radialGradient5833"
114 xlink:href="#linearGradient5827" />
115 <radialGradient
116 gradientTransform="matrix(0.94444444,0,0,0.94444444,6.0555566,25.965278)"
117 gradientUnits="userSpaceOnUse"
118 r="18"
119 fy="485.375"
120 fx="109"
121 cy="485.375"
122 cx="109"
123 id="radialGradient5833-9"
124 xlink:href="#linearGradient5827" />
125 </defs>
126 <metadata
127 id="metadata7">
128 <rdf:RDF>
129 <cc:Work
130 rdf:about="">
131 <dc:format>image/svg+xml</dc:format>
132 <dc:type
133 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
134 <dc:title></dc:title>
135 </cc:Work>
136 </rdf:RDF>
137 </metadata>
138 <g
139 transform="translate(-91,-467.375)"
140 id="layer1">
141 <path
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"
143 id="path2555-7-1-4-4-8-6-5-1-0-2-9-5"
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" />
145 <path
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"
147 id="path2555-7-1-4-4-8-6-5-1-0-2-9-5-9"
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" />
149 <path
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"
151 id="path2555-7-1-4-4-8-6-5-1-0-2-9"
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" />
153 <path
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"
155 id="path3019-2-0-4-7-1-46-65-2-0"
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" />
157 <path
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"
159 id="path8655-2"
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" />
161 <path
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"
163 id="path5787"
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" />
165 <path
166 id="rect5962-1"
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"
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" />
169 <path
170 transform="translate(91,467.375)"
171 id="rect5962"
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 "
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" />
174 </g>
175</svg>
0176
=== modified file 'lib/Utils.vala'
--- lib/Utils.vala 2016-11-15 16:13:39 +0000
+++ lib/Utils.vala 2016-12-18 21:20:25 +0000
@@ -25,6 +25,7 @@
25 static uint cache_clear_timeout = 0;25 static uint cache_clear_timeout = 0;
2626
27 static Gdk.Pixbuf? close_pixbuf = null;27 static Gdk.Pixbuf? close_pixbuf = null;
28 static int close_pixbuf_scale = 0;
2829
29 static construct30 static construct
30 {31 {
@@ -290,11 +291,12 @@
290 *291 *
291 * @return the close button pixbuf or null if it failed to load292 * @return the close button pixbuf or null if it failed to load
292 */293 */
293 public static Gdk.Pixbuf? get_close_button_pixbuf ()294 public static Gdk.Pixbuf? get_close_button_pixbuf (int scale_factor)
294 {295 {
295 if (close_pixbuf == null) {296 if (close_pixbuf == null || close_pixbuf_scale != scale_factor) {
296 try {297 try {
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);
299 close_pixbuf_scale = scale_factor;
298 } catch (Error e) {300 } catch (Error e) {
299 warning (e.message);301 warning (e.message);
300 return null;302 return null;
@@ -309,10 +311,10 @@
309 *311 *
310 * @return The close button actor312 * @return The close button actor
311 */313 */
312 public static Clutter.Actor create_close_button ()314 public static Clutter.Actor create_close_button (int scale_factor = 1)
313 {315 {
314 var texture = new Clutter.Texture ();316 var texture = new Clutter.Texture ();
315 var pixbuf = get_close_button_pixbuf ();317 var pixbuf = get_close_button_pixbuf (scale_factor);
316318
317 texture.reactive = true;319 texture.reactive = true;
318320
@@ -326,7 +328,7 @@
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
327 // indicator that loading failed. Should never happen and this329 // indicator that loading failed. Should never happen and this
328 // works as good as some weird fallback-image-failed-to-load pixbuf330 // works as good as some weird fallback-image-failed-to-load pixbuf
329 texture.set_size (36, 36);331 texture.set_size (36 * scale_factor, 36 * scale_factor);
330 texture.background_color = { 255, 0, 0, 255 };332 texture.background_color = { 255, 0, 0, 255 };
331 }333 }
332334
333335
=== modified file 'lib/WindowManager.vala'
--- lib/WindowManager.vala 2015-03-04 11:07:30 +0000
+++ lib/WindowManager.vala 2016-12-18 21:20:25 +0000
@@ -92,6 +92,11 @@
92 public abstract Meta.BackgroundGroup background_group { get; protected set; }92 public abstract Meta.BackgroundGroup background_group { get; protected set; }
9393
94 /**94 /**
95 * The scale factor is the scale used by all user-facing elements
96 */
97 public abstract int scale_factor { get; protected set; }
98
99 /**
95 * Enters the modal mode, which means that all events are directed to the stage instead100 * Enters the modal mode, which means that all events are directed to the stage instead
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.
97 *102 *
98103
=== modified file 'plugins/notify/ConfirmationNotification.vala'
--- plugins/notify/ConfirmationNotification.vala 2014-07-21 01:21:19 +0000
+++ plugins/notify/ConfirmationNotification.vala 2016-12-18 21:20:25 +0000
@@ -55,7 +55,7 @@
5555
56 public override void update_allocation (out float content_height, AllocationFlags flags)56 public override void update_allocation (out float content_height, AllocationFlags flags)
57 {57 {
58 content_height = ICON_SIZE;58 content_height = ICON_SIZE * style_context.get_scale ();
59 }59 }
6060
61 public override void draw_content (Cairo.Context cr)61 public override void draw_content (Cairo.Context cr)
@@ -63,14 +63,21 @@
63 if (!has_progress)63 if (!has_progress)
64 return;64 return;
6565
66 var x = MARGIN + PADDING + ICON_SIZE + SPACING;66 var scale = style_context.get_scale ();
67 var y = MARGIN + PADDING + (ICON_SIZE - PROGRESS_HEIGHT) / 2;67 var scaled_width = WIDTH * scale;
68 var width = WIDTH - x - MARGIN;68 var scaled_margin = MARGIN * scale;
69 var scaled_padding = PADDING * scale;
70 var scaled_icon_size = ICON_SIZE * scale;
71 var scaled_spacing = SPACING * scale;
72 var scaled_progress_height = PROGRESS_HEIGHT * scale;
73 var x = scaled_margin + scaled_padding + scaled_icon_size + scaled_spacing;
74 var y = scaled_margin + scaled_padding + (scaled_icon_size - scaled_progress_height) / 2;
75 var width = scaled_width - x - scaled_margin;
6976
70 if (!transitioning)77 if (!transitioning)
71 draw_progress_bar (cr, x, y, width, progress);78 draw_progress_bar (cr, x, y, width, progress);
72 else {79 else {
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);
74 cr.clip ();81 cr.clip ();
7582
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);
@@ -82,16 +89,18 @@
8289
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)
84 {91 {
92 var scale = style_context.get_scale ();
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);
8694
95 var scaled_height = PROGRESS_HEIGHT * scale;
87 Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, width,96 Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, width,
88 PROGRESS_HEIGHT, PROGRESS_HEIGHT / 2);97 scaled_height, scaled_height / 2);
89 cr.set_source_rgb (0.8, 0.8, 0.8);98 cr.set_source_rgb (0.8, 0.8, 0.8);
90 cr.fill ();99 cr.fill ();
91100
92 if (progress > 0) {101 if (progress > 0) {
93 Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, fraction,102 Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, x, y, fraction,
94 PROGRESS_HEIGHT, PROGRESS_HEIGHT / 2);103 scaled_height, scaled_height / 2);
95 cr.set_source_rgb (0.3, 0.3, 0.3);104 cr.set_source_rgb (0.3, 0.3, 0.3);
96 cr.fill ();105 cr.fill ();
97 }106 }
@@ -111,7 +120,7 @@
111120
112 old_progress = this.progress;121 old_progress = this.progress;
113122
114 play_update_transition (ICON_SIZE + PADDING * 2);123 play_update_transition ((ICON_SIZE + PADDING * 2) * style_context.get_scale ());
115 }124 }
116125
117 if (this.icon_only != icon_only) {126 if (this.icon_only != icon_only) {
118127
=== modified file 'plugins/notify/Main.vala'
--- plugins/notify/Main.vala 2014-07-18 11:12:31 +0000
+++ plugins/notify/Main.vala 2016-12-18 21:20:25 +0000
@@ -30,9 +30,8 @@
30 public override void initialize (Gala.WindowManager wm)30 public override void initialize (Gala.WindowManager wm)
31 {31 {
32 this.wm = wm;32 this.wm = wm;
33 var screen = wm.get_screen ();
3433
35 stack = new NotificationStack (wm.get_screen ());34 stack = new NotificationStack (wm);
36 wm.ui_group.add_child (stack);35 wm.ui_group.add_child (stack);
37 track_actor (stack);36 track_actor (stack);
3837
@@ -43,6 +42,7 @@
43 server = new NotifyServer (stack);42 server = new NotifyServer (stack);
4443
45 update_position ();44 update_position ();
45 unowned Meta.Screen screen = wm.get_screen ();
46 screen.monitors_changed.connect (update_position);46 screen.monitors_changed.connect (update_position);
47 screen.workareas_changed.connect (update_position);47 screen.workareas_changed.connect (update_position);
4848
@@ -64,7 +64,7 @@
6464
65 void update_position ()65 void update_position ()
66 {66 {
67 var screen = wm.get_screen ();67 unowned Meta.Screen screen = wm.get_screen ();
68 var primary = screen.get_primary_monitor ();68 var primary = screen.get_primary_monitor ();
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);
7070
7171
=== modified file 'plugins/notify/Makefile.am'
--- plugins/notify/Makefile.am 2015-03-04 10:56:41 +0000
+++ plugins/notify/Makefile.am 2016-12-18 21:20:25 +0000
@@ -3,7 +3,7 @@
3VAPIDIR = $(top_srcdir)/vapi3VAPIDIR = $(top_srcdir)/vapi
44
5imagedir = $(pkgdatadir)5imagedir = $(pkgdatadir)
6dist_image_DATA = data/image-mask.png6dist_image_DATA = data/image-mask.svg
77
8BUILT_SOURCES = libgala_notify_la_vala.stamp8BUILT_SOURCES = libgala_notify_la_vala.stamp
99
1010
=== modified file 'plugins/notify/NormalNotification.vala'
--- plugins/notify/NormalNotification.vala 2016-08-04 07:37:29 +0000
+++ plugins/notify/NormalNotification.vala 2016-12-18 21:20:25 +0000
@@ -38,6 +38,8 @@
38 } catch (Error e) {}38 } catch (Error e) {}
39 }39 }
4040
41 public unowned Gtk.StyleContext parent_style_context { get; construct; }
42
41 const int LABEL_SPACING = 2;43 const int LABEL_SPACING = 2;
4244
43 Text summary_label;45 Text summary_label;
@@ -64,6 +66,7 @@
64 var label_style_context = new Gtk.StyleContext ();66 var label_style_context = new Gtk.StyleContext ();
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);
66 label_style_context.set_path (style_path);68 label_style_context.set_path (style_path);
69 label_style_context.set_parent (parent_style_context);
6770
68 Gdk.RGBA color;71 Gdk.RGBA color;
6972
@@ -93,6 +96,11 @@
93 add_child (body_label);96 add_child (body_label);
94 }97 }
9598
99 public NormalNotificationContent (Gtk.StyleContext parent_style_context)
100 {
101 Object (parent_style_context: parent_style_context);
102 }
103
96 public void set_values (string summary, string body)104 public void set_values (string summary, string body)
97 {105 {
98 summary_label.set_markup ("<b>%s</b>".printf (fix_markup (summary)));106 summary_label.set_markup ("<b>%s</b>".printf (fix_markup (summary)));
@@ -119,7 +127,7 @@
119 summary_label.allocate (summary_alloc, flags);127 summary_label.allocate (summary_alloc, flags);
120128
121 var body_alloc = ActorBox ();129 var body_alloc = ActorBox ();
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 ());
123 body_alloc.set_size (label_width, body_height);131 body_alloc.set_size (label_width, body_height);
124 body_label.allocate (body_alloc, flags);132 body_label.allocate (body_alloc, flags);
125133
@@ -129,16 +137,22 @@
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,
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)
131 {139 {
132 var height = Notification.ICON_SIZE;140 var scale = parent_style_context.get_scale ();
141 var height = Notification.ICON_SIZE * scale;
142 var width = scale * Notification.WIDTH;
143 var margin = scale * Notification.MARGIN;
144 var padding = scale * Notification.PADDING;
145 var spacing = scale * Notification.SPACING;
146 var label_spacing = scale * LABEL_SPACING;
133147
134 label_x = Notification.MARGIN + Notification.PADDING + height + Notification.SPACING;148 label_x = margin + padding + height + spacing;
135 label_width = Notification.WIDTH - label_x - Notification.MARGIN - Notification.SPACING;149 label_width = width - label_x - margin - spacing;
136150
137 summary_label.get_preferred_height (label_width, null, out summary_height);151 summary_label.get_preferred_height (label_width, null, out summary_height);
138 body_label.get_preferred_height (label_width, null, out body_height);152 body_label.get_preferred_height (label_width, null, out body_height);
139153
140 label_height = summary_height + LABEL_SPACING + body_height;154 label_height = summary_height + label_spacing + body_height;
141 label_y = Notification.MARGIN + Notification.PADDING;155 label_y = margin + padding;
142 // center156 // center
143 if (label_height < height) {157 if (label_height < height) {
144 label_y += (height - (int) label_height) / 2;158 label_y += (height - (int) label_height) / 2;
@@ -168,13 +182,13 @@
168 public string body { get; construct set; }182 public string body { get; construct set; }
169 public uint32 sender_pid { get; construct; }183 public uint32 sender_pid { get; construct; }
170 public string[] notification_actions { get; construct set; }184 public string[] notification_actions { get; construct set; }
171 public Screen screen { get; construct; }185 public unowned Gala.WindowManager wm { get; construct; }
172186
173 Actor content_container;187 Actor content_container;
174 NormalNotificationContent notification_content;188 NormalNotificationContent notification_content;
175 NormalNotificationContent? old_notification_content = null;189 NormalNotificationContent? old_notification_content = null;
176190
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,
178 NotificationUrgency urgency, int32 expire_timeout, uint32 pid, string[] actions)192 NotificationUrgency urgency, int32 expire_timeout, uint32 pid, string[] actions)
179 {193 {
180 Object (194 Object (
@@ -182,7 +196,7 @@
182 icon: icon,196 icon: icon,
183 urgency: urgency,197 urgency: urgency,
184 expire_timeout: expire_timeout,198 expire_timeout: expire_timeout,
185 screen: screen,199 wm: wm,
186 summary: summary,200 summary: summary,
187 body: body,201 body: body,
188 sender_pid: pid,202 sender_pid: pid,
@@ -192,9 +206,10 @@
192206
193 construct207 construct
194 {208 {
209 set_scale_factor (wm.scale_factor);
195 content_container = new Actor ();210 content_container = new Actor ();
196211
197 notification_content = new NormalNotificationContent ();212 notification_content = new NormalNotificationContent (style_context);
198 notification_content.set_values (summary, body);213 notification_content.set_values (summary, body);
199214
200 content_container.add_child (notification_content);215 content_container.add_child (notification_content);
@@ -210,7 +225,7 @@
210 if (old_notification_content != null)225 if (old_notification_content != null)
211 old_notification_content.destroy ();226 old_notification_content.destroy ();
212227
213 old_notification_content = new NormalNotificationContent ();228 old_notification_content = new NormalNotificationContent (style_context);
214 old_notification_content.set_values (this.summary, this.body);229 old_notification_content.set_values (this.summary, this.body);
215230
216 content_container.add_child (old_notification_content);231 content_container.add_child (old_notification_content);
@@ -225,7 +240,7 @@
225240
226 content_height = float.max (content_height, old_content_height);241 content_height = float.max (content_height, old_content_height);
227242
228 play_update_transition (content_height + PADDING * 2);243 play_update_transition (content_height + PADDING * 2 * style_context.get_scale ());
229244
230 get_transition ("switch").completed.connect (() => {245 get_transition ("switch").completed.connect (() => {
231 if (old_notification_content != null)246 if (old_notification_content != null)
@@ -257,8 +272,10 @@
257 // the for_width is not needed in our implementation of get_preferred_height as we272 // the for_width is not needed in our implementation of get_preferred_height as we
258 // assume a constant width273 // assume a constant width
259 notification_content.get_preferred_height (0, null, out content_height);274 notification_content.get_preferred_height (0, null, out content_height);
275 var scale = style_context.get_scale ();
276 var scaled_margin = MARGIN * scale;
260277
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);
262 }279 }
263280
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)
@@ -266,7 +283,7 @@
266 float content_height;283 float content_height;
267 notification_content.get_preferred_height (for_width, null, out content_height);284 notification_content.get_preferred_height (for_width, null, out content_height);
268285
269 min_height = nat_height = content_height + (MARGIN + PADDING) * 2;286 min_height = nat_height = content_height + ((MARGIN + PADDING) * 2) * style_context.get_scale ();
270 }287 }
271288
272 public override void activate ()289 public override void activate ()
@@ -287,6 +304,7 @@
287 unowned Meta.Window? window = get_window ();304 unowned Meta.Window? window = get_window ();
288 if (window != null) {305 if (window != null) {
289 unowned Meta.Workspace workspace = window.get_workspace ();306 unowned Meta.Workspace workspace = window.get_workspace ();
307 unowned Meta.Screen screen = wm.get_screen ();
290 var time = screen.get_display ().get_current_time ();308 var time = screen.get_display ().get_current_time ();
291309
292 if (workspace != screen.get_active_workspace ())310 if (workspace != screen.get_active_workspace ())
@@ -303,6 +321,7 @@
303 if (sender_pid == 0)321 if (sender_pid == 0)
304 return null;322 return null;
305323
324 unowned Meta.Screen screen = wm.get_screen ();
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)) {
307 if (actor.is_destroyed ())326 if (actor.is_destroyed ())
308 continue;327 continue;
309328
=== modified file 'plugins/notify/Notification.vala'
--- plugins/notify/Notification.vala 2016-11-15 16:13:39 +0000
+++ plugins/notify/Notification.vala 2016-12-18 21:20:25 +0000
@@ -53,7 +53,7 @@
5353
54 Clutter.Actor close_button;54 Clutter.Actor close_button;
5555
56 Gtk.StyleContext style_context;56 protected Gtk.StyleContext style_context { get; private set; }
5757
58 uint remove_timeout = 0;58 uint remove_timeout = 0;
5959
@@ -99,20 +99,7 @@
99 icon_container = new Actor ();99 icon_container = new Actor ();
100 icon_container.add_child (icon_texture);100 icon_container.add_child (icon_texture);
101101
102 close_button = Utils.create_close_button ();
103 close_button.opacity = 0;
104 close_button.reactive = true;
105 close_button.set_easing_duration (300);
106
107 var close_click = new ClickAction ();
108 close_click.clicked.connect (() => {
109 closed (id, NotificationClosedReason.DISMISSED);
110 close ();
111 });
112 close_button.add_action (close_click);
113
114 add_child (icon_container);102 add_child (icon_container);
115 add_child (close_button);
116103
117 if (default_css == null) {104 if (default_css == null) {
118 default_css = new Gtk.CssProvider ();105 default_css = new Gtk.CssProvider ();
@@ -132,6 +119,8 @@
132 style_context.add_class ("gala-notification");119 style_context.add_class ("gala-notification");
133 style_context.set_path (style_path);120 style_context.set_path (style_path);
134121
122 create_close_button ();
123
135 var label_style_path = style_path.copy ();124 var label_style_path = style_path.copy ();
136 label_style_path.iter_add_class (1, "gala-notification");125 label_style_path.iter_add_class (1, "gala-notification");
137 label_style_path.append_type (typeof (Gtk.Label));126 label_style_path.append_type (typeof (Gtk.Label));
@@ -227,6 +216,26 @@
227 destroy ();216 destroy ();
228 }217 }
229218
219 void create_close_button () {
220 if (close_button != null)
221 {
222 close_button.destroy ();
223 }
224
225 close_button = Utils.create_close_button (style_context.get_scale ());
226 close_button.opacity = 0;
227 close_button.reactive = true;
228 close_button.set_easing_duration (300);
229
230 var close_click = new ClickAction ();
231 close_click.clicked.connect (() => {
232 closed (id, NotificationClosedReason.DISMISSED);
233 close ();
234 });
235 close_button.add_action (close_click);
236 add_child (close_button);
237 }
238
230 protected void update_base (Gdk.Pixbuf? icon, int32 expire_timeout)239 protected void update_base (Gdk.Pixbuf? icon, int32 expire_timeout)
231 {240 {
232 this.icon = icon;241 this.icon = icon;
@@ -273,6 +282,16 @@
273 }282 }
274 }283 }
275284
285 public void set_scale_factor (int scale_factor)
286 {
287 style_context.set_scale (scale_factor);
288 width = (WIDTH + MARGIN * 2) * scale_factor;
289 create_close_button ();
290 if (content is Canvas) {
291 ((Canvas) content).set_scale_factor (scale_factor);
292 }
293 }
294
276 public override bool enter_event (CrossingEvent event)295 public override bool enter_event (CrossingEvent event)
277 {296 {
278 close_button.opacity = 255;297 close_button.opacity = 255;
@@ -304,21 +323,26 @@
304323
305 public override void allocate (ActorBox box, AllocationFlags flags)324 public override void allocate (ActorBox box, AllocationFlags flags)
306 {325 {
326 var scale = style_context.get_scale ();
327 var scaled_width = WIDTH * scale;
328 var scaled_icon_size = ICON_SIZE * scale;
329 var scaled_margin = MARGIN * scale;
330 var scaled_padding = PADDING * scale;
331 var margin_padding = scaled_margin + scaled_padding;
307 var icon_alloc = ActorBox ();332 var icon_alloc = ActorBox ();
308333
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);
310 icon_alloc.set_size (ICON_SIZE, ICON_SIZE);335 icon_alloc.set_size (scaled_icon_size, scaled_icon_size);
311 icon_container.allocate (icon_alloc, flags);336 icon_container.allocate (icon_alloc, flags);
312337
313 var close_alloc = ActorBox ();338 var close_alloc = ActorBox ();
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);
315 MARGIN + PADDING - close_button.height / 2);
316 close_alloc.set_size (close_button.width, close_button.height);340 close_alloc.set_size (close_button.width, close_button.height);
317 close_button.allocate (close_alloc, flags);341 close_button.allocate (close_alloc, flags);
318342
319 float content_height;343 float content_height;
320 update_allocation (out content_height, flags);344 update_allocation (out content_height, flags);
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);
322346
323 base.allocate (box, flags);347 base.allocate (box, flags);
324348
@@ -331,7 +355,7 @@
331355
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)
333 {357 {
334 min_height = nat_height = ICON_SIZE + (MARGIN + PADDING) * 2;358 min_height = nat_height = (ICON_SIZE + (MARGIN + PADDING) * 2) * style_context.get_scale ();
335 }359 }
336360
337 protected void play_update_transition (float slide_height)361 protected void play_update_transition (float slide_height)
@@ -346,7 +370,8 @@
346370
347 old_texture = new Clutter.Texture ();371 old_texture = new Clutter.Texture ();
348 icon_container.add_child (old_texture);372 icon_container.add_child (old_texture);
349 icon_container.set_clip (0, -PADDING, ICON_SIZE, ICON_SIZE + PADDING * 2);373 var scale = style_context.get_scale ();
374 icon_container.set_clip (0, -PADDING * scale, ICON_SIZE * scale, (ICON_SIZE + PADDING * 2) * scale);
350375
351 if (icon != null) {376 if (icon != null) {
352 try {377 try {
@@ -382,10 +407,12 @@
382 {407 {
383 var canvas = (Canvas) content;408 var canvas = (Canvas) content;
384409
385 var x = MARGIN;410 var scale = style_context.get_scale ();
386 var y = MARGIN;411 var margin_scaled = MARGIN * scale;
387 var width = canvas.width - MARGIN * 2;412 var x = margin_scaled;
388 var height = canvas.height - MARGIN * 2;413 var y = margin_scaled;
414 var width = canvas.width - margin_scaled * 2;
415 var height = canvas.height - margin_scaled * 2;
389 cr.set_operator (Cairo.Operator.CLEAR);416 cr.set_operator (Cairo.Operator.CLEAR);
390 cr.paint ();417 cr.paint ();
391 cr.set_operator (Cairo.Operator.OVER);418 cr.set_operator (Cairo.Operator.OVER);
392419
=== modified file 'plugins/notify/NotificationStack.vala'
--- plugins/notify/NotificationStack.vala 2016-07-28 22:19:16 +0000
+++ plugins/notify/NotificationStack.vala 2016-12-18 21:20:25 +0000
@@ -29,16 +29,16 @@
2929
30 public signal void animations_changed (bool running);30 public signal void animations_changed (bool running);
3131
32 public Screen screen { get; construct; }32 public unowned Gala.WindowManager wm { get; construct; }
3333
34 public NotificationStack (Screen screen)34 public NotificationStack (Gala.WindowManager wm)
35 {35 {
36 Object (screen: screen);36 Object (wm: wm);
37 }37 }
3838
39 construct39 construct
40 {40 {
41 width = Notification.WIDTH + 2 * Notification.MARGIN + ADDITIONAL_MARGIN;41 width = (Notification.WIDTH + 2 * Notification.MARGIN + ADDITIONAL_MARGIN) * wm.scale_factor;
42 clip_to_allocation = true;42 clip_to_allocation = true;
43 }43 }
4444
@@ -67,16 +67,17 @@
67 });67 });
6868
69 float height;69 float height;
70 notification.get_preferred_height (Notification.WIDTH, out height, null);70 int scale_factor = wm.scale_factor;
71 notification.get_preferred_height (Notification.WIDTH * scale_factor, out height, null);
71 update_positions (height);72 update_positions (height);
7273
73 notification.y = TOP_OFFSET;74 notification.y = TOP_OFFSET * scale_factor;
74 insert_child_at_index (notification, 0);75 insert_child_at_index (notification, 0);
75 }76 }
7677
77 void update_positions (float add_y = 0.0f)78 void update_positions (float add_y = 0.0f)
78 {79 {
79 var y = add_y + TOP_OFFSET;80 var y = add_y + TOP_OFFSET * wm.scale_factor;
80 var i = get_n_children ();81 var i = get_n_children ();
81 var delay_step = i > 0 ? 150 / i : 0;82 var delay_step = i > 0 ? 150 / i : 0;
82 foreach (var child in get_children ()) {83 foreach (var child in get_children ()) {
8384
=== modified file 'plugins/notify/NotifyServer.vala'
--- plugins/notify/NotifyServer.vala 2016-08-21 13:43:54 +0000
+++ plugins/notify/NotifyServer.vala 2016-12-18 21:20:25 +0000
@@ -52,6 +52,7 @@
52 const string FALLBACK_APP_ID = "gala-other";52 const string FALLBACK_APP_ID = "gala-other";
5353
54 static Gdk.RGBA? icon_fg_color = null;54 static Gdk.RGBA? icon_fg_color = null;
55 static Gdk.Pixbuf image_mask_pixbuf = null;
5556
56 [DBus (visible = false)]57 [DBus (visible = false)]
57 public signal void show_notification (Notification notification);58 public signal void show_notification (Notification notification);
@@ -169,7 +170,8 @@
169 icon = app_info.get_icon ().to_string ();170 icon = app_info.get_icon ().to_string ();
170171
171 var id = (replaces_id != 0 ? replaces_id : ++id_counter);172 var id = (replaces_id != 0 ? replaces_id : ++id_counter);
172 var pixbuf = get_pixbuf (app_name, icon, hints);173 unowned Gala.WindowManager wm = stack.wm;
174 var pixbuf = get_pixbuf (app_name, icon, hints, wm.scale_factor);
173 var timeout = (expire_timeout == uint32.MAX ? DEFAULT_TMEOUT : expire_timeout);175 var timeout = (expire_timeout == uint32.MAX ? DEFAULT_TMEOUT : expire_timeout);
174176
175 var urgency = NotificationUrgency.NORMAL;177 var urgency = NotificationUrgency.NORMAL;
@@ -284,9 +286,10 @@
284 progress ? hints.@get ("value").get_int32 () : -1,286 progress ? hints.@get ("value").get_int32 () : -1,
285 hints.@get (X_CANONICAL_PRIVATE_SYNCHRONOUS).get_string ());287 hints.@get (X_CANONICAL_PRIVATE_SYNCHRONOUS).get_string ());
286 else288 else
287 notification = new NormalNotification (stack.screen, id, summary, body, pixbuf,289 notification = new NormalNotification (wm, id, summary, body, pixbuf,
288 urgency, timeout, pid, actions);290 urgency, timeout, pid, actions);
289291
292 notification.set_scale_factor (wm.scale_factor);
290 notification.action_invoked.connect (notification_action_invoked_callback);293 notification.action_invoked.connect (notification_action_invoked_callback);
291 notification.closed.connect (notification_closed_callback);294 notification.closed.connect (notification_closed_callback);
292 stack.show_notification (notification);295 stack.show_notification (notification);
@@ -325,7 +328,7 @@
325 return icon_fg_color;328 return icon_fg_color;
326 }329 }
327330
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)
329 {332 {
330 // decide on the icon, order:333 // decide on the icon, order:
331 // - image-data334 // - image-data
@@ -337,8 +340,8 @@
337340
338 Gdk.Pixbuf? pixbuf = null;341 Gdk.Pixbuf? pixbuf = null;
339 Variant? variant = null;342 Variant? variant = null;
340 var size = Notification.ICON_SIZE;343 var size = Notification.ICON_SIZE * scale_factor;
341 var mask_offset = 4;344 var mask_offset = 4 * scale_factor;
342 var mask_size_offset = mask_offset * 2;345 var mask_size_offset = mask_offset * 2;
343 var has_mask = false;346 var has_mask = false;
344347
@@ -402,7 +405,7 @@
402 } catch (Error e) { warning (e.message); }405 } catch (Error e) { warning (e.message); }
403 }406 }
404 } else if (has_mask) {407 } else if (has_mask) {
405 var mask_size = Notification.ICON_SIZE;408 var mask_size = Notification.ICON_SIZE * scale_factor;
406 var offset_x = mask_offset;409 var offset_x = mask_offset;
407 var offset_y = mask_offset + 1;410 var offset_y = mask_offset + 1;
408411
@@ -418,8 +421,15 @@
418421
419 cr.reset_clip ();422 cr.reset_clip ();
420423
421 var mask = new Cairo.ImageSurface.from_png (Config.PKGDATADIR + "/image-mask.png");424 if (image_mask_pixbuf == null) {
422 cr.set_source_surface (mask, 0, 0);425 try {
426 image_mask_pixbuf = new Gdk.Pixbuf.from_file_at_scale (Config.PKGDATADIR + "/image-mask.svg", -1, 48 * scale_factor, true);
427 } catch (Error e) {
428 warning (e.message);
429 }
430 }
431
432 Gdk.cairo_set_source_pixbuf (cr, image_mask_pixbuf, 0, 0);
423 cr.paint ();433 cr.paint ();
424434
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);
426436
=== removed file 'plugins/notify/data/image-mask.png'
427Binary 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 differ437Binary 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
=== added file 'plugins/notify/data/image-mask.svg'
--- plugins/notify/data/image-mask.svg 1970-01-01 00:00:00 +0000
+++ plugins/notify/data/image-mask.svg 2016-12-18 21:20:25 +0000
@@ -0,0 +1,235 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<svg
3 xmlns:dc="http://purl.org/dc/elements/1.1/"
4 xmlns:cc="http://creativecommons.org/ns#"
5 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6 xmlns:svg="http://www.w3.org/2000/svg"
7 xmlns="http://www.w3.org/2000/svg"
8 xmlns:xlink="http://www.w3.org/1999/xlink"
9 width="48"
10 height="48"
11 id="svg2"
12 version="1.1">
13 <defs
14 id="defs4">
15 <linearGradient
16 x1="45.447727"
17 y1="92.539597"
18 x2="45.447727"
19 y2="7.0165396"
20 id="ButtonShadow-9"
21 gradientUnits="userSpaceOnUse"
22 gradientTransform="scale(1.0058652,0.994169)">
23 <stop
24 id="stop3750-3"
25 style="stop-color:#000000;stop-opacity:1"
26 offset="0" />
27 <stop
28 id="stop3752-1"
29 style="stop-color:#000000;stop-opacity:0.58823532"
30 offset="1" />
31 </linearGradient>
32 <filter
33 id="filter3174-4"
34 style="color-interpolation-filters:sRGB">
35 <feGaussianBlur
36 id="feGaussianBlur3176-5"
37 stdDeviation="1.71" />
38 </filter>
39 <linearGradient
40 x1="45.447727"
41 y1="92.539597"
42 x2="45.447727"
43 y2="7.0165396"
44 id="ButtonShadow"
45 gradientUnits="userSpaceOnUse"
46 gradientTransform="scale(1.0058652,0.994169)">
47 <stop
48 id="stop3750-9"
49 style="stop-color:#000000;stop-opacity:1"
50 offset="0" />
51 <stop
52 id="stop3752-7"
53 style="stop-color:#000000;stop-opacity:0.58823532"
54 offset="1" />
55 </linearGradient>
56 <filter
57 id="filter3174"
58 style="color-interpolation-filters:sRGB">
59 <feGaussianBlur
60 id="feGaussianBlur3176"
61 stdDeviation="1.71" />
62 </filter>
63 <linearGradient
64 xlink:href="#ButtonShadow-9"
65 id="linearGradient6176"
66 gradientUnits="userSpaceOnUse"
67 gradientTransform="scale(1.0058652,0.994169)"
68 x1="45.447727"
69 y1="92.539597"
70 x2="45.447727"
71 y2="7.0165396" />
72 <linearGradient
73 xlink:href="#ButtonShadow"
74 id="linearGradient6178"
75 gradientUnits="userSpaceOnUse"
76 gradientTransform="scale(1.0058652,0.994169)"
77 x1="45.447727"
78 y1="92.539597"
79 x2="45.447727"
80 y2="7.0165396" />
81 <linearGradient
82 id="linearGradient3688-464-309-9-2-4-2">
83 <stop
84 offset="0"
85 style="stop-color:#181818;stop-opacity:1"
86 id="stop2889-7-9-6-9" />
87 <stop
88 offset="1"
89 style="stop-color:#181818;stop-opacity:0"
90 id="stop2891-6-6-1-7" />
91 </linearGradient>
92 <linearGradient
93 id="linearGradient3702-501-757-8-4-1-1-9">
94 <stop
95 offset="0"
96 style="stop-color:#181818;stop-opacity:0"
97 id="stop2895-8-9-9-1-4" />
98 <stop
99 offset="0.5"
100 style="stop-color:#181818;stop-opacity:1"
101 id="stop2897-7-8-7-7-3" />
102 <stop
103 offset="1"
104 style="stop-color:#181818;stop-opacity:0"
105 id="stop2899-4-5-1-5-6" />
106 </linearGradient>
107 <linearGradient
108 gradientTransform="translate(0,1.0000172)"
109 gradientUnits="userSpaceOnUse"
110 xlink:href="#linearGradient3924-1-7-54"
111 id="linearGradient3028-82"
112 y2="41.978722"
113 x2="40"
114 y1="5.9999828"
115 x1="40" />
116 <linearGradient
117 id="linearGradient3924-1-7-54">
118 <stop
119 offset="0"
120 style="stop-color:#ffffff;stop-opacity:1"
121 id="stop3926-3-4-4" />
122 <stop
123 offset="0.02779419"
124 style="stop-color:#ffffff;stop-opacity:0.23529412"
125 id="stop3928-91-41-8" />
126 <stop
127 offset="0.97279674"
128 style="stop-color:#ffffff;stop-opacity:0.15686275"
129 id="stop3930-6-6-6" />
130 <stop
131 offset="1"
132 style="stop-color:#ffffff;stop-opacity:0.39215687"
133 id="stop3932-6-6-7" />
134 </linearGradient>
135 <linearGradient
136 gradientTransform="matrix(1.1578952,0,0,0.6428571,-3.78948,16.285716)"
137 gradientUnits="userSpaceOnUse"
138 xlink:href="#linearGradient3702-501-757-8-4-1-1-9"
139 id="linearGradient6084-5"
140 y2="39.999443"
141 x2="25.058096"
142 y1="47.027729"
143 x1="25.058096" />
144 <radialGradient
145 gradientTransform="matrix(2.3201719,0,0,0.89999994,28.617841,5.100003)"
146 gradientUnits="userSpaceOnUse"
147 xlink:href="#linearGradient3688-464-309-9-2-4-2"
148 id="radialGradient3013-3-1"
149 fy="43.5"
150 fx="4.9929786"
151 r="2.5"
152 cy="43.5"
153 cx="4.9929786" />
154 <radialGradient
155 gradientTransform="matrix(-2.3201719,0,0,0.89999994,19.382159,5.100003)"
156 gradientUnits="userSpaceOnUse"
157 xlink:href="#linearGradient3688-464-309-9-2-4-2"
158 id="radialGradient3013-3-1-8"
159 fy="43.5"
160 fx="4.9929786"
161 r="2.5"
162 cy="43.5"
163 cx="4.9929786" />
164 </defs>
165 <metadata
166 id="metadata7">
167 <rdf:RDF>
168 <cc:Work
169 rdf:about="">
170 <dc:format>image/svg+xml</dc:format>
171 <dc:type
172 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
173 <dc:title></dc:title>
174 </cc:Work>
175 </rdf:RDF>
176 </metadata>
177 <path
178 id="path10394"
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 "
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" />
181 <path
182 id="rect3700-4"
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 "
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" />
185 <g
186 transform="translate(906.27272,-452.04544)"
187 style="display:none"
188 id="layer2">
189 <rect
190 style="opacity:0.9;fill:url(#linearGradient6178);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3174)"
191 id="rect3745"
192 y="7"
193 x="5"
194 ry="6"
195 rx="6"
196 height="85"
197 width="86" />
198 </g>
199 <g
200 transform="translate(903,-452.40908)"
201 style="display:none"
202 id="layer2-4">
203 <rect
204 style="opacity:0.9;fill:url(#linearGradient6176);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3174-4)"
205 id="rect3745-5"
206 y="7"
207 x="5"
208 ry="6"
209 rx="6"
210 height="85"
211 width="86" />
212 </g>
213 <rect
214 width="37"
215 height="37"
216 rx="1"
217 ry="1"
218 x="5.5"
219 y="6.5"
220 id="rect6741-11-6"
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" />
222 <rect
223 width="39"
224 height="39"
225 rx="2"
226 ry="2"
227 x="4.5"
228 y="5.5"
229 id="rect5505-21-3-2-7-4"
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" />
231 <path
232 id="path10394-3"
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"
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" />
235</svg>
0236
=== modified file 'src/WindowManager.vala'
--- src/WindowManager.vala 2016-11-18 16:57:03 +0000
+++ src/WindowManager.vala 2016-12-18 21:20:25 +0000
@@ -68,6 +68,11 @@
68 */68 */
69 public Meta.BackgroundGroup background_group { get; protected set; }69 public Meta.BackgroundGroup background_group { get; protected set; }
7070
71 /**
72 * {@inheritDoc}
73 */
74 public int scale_factor { get; protected set; }
75
71 Meta.PluginInfo info;76 Meta.PluginInfo info;
7277
73 WindowSwitcher? winswitcher = null;78 WindowSwitcher? winswitcher = null;
@@ -144,6 +149,8 @@
144 WindowListener.init (screen);149 WindowListener.init (screen);
145 KeyboardManager.init (display);150 KeyboardManager.init (display);
146151
152 compute_scale_factor ();
153
147 // Due to a bug which enables access to the stage when using multiple monitors154 // Due to a bug which enables access to the stage when using multiple monitors
148 // in the screensaver, we have to listen for changes and make sure the input area155 // in the screensaver, we have to listen for changes and make sure the input area
149 // is set to NONE when we are in locked mode156 // is set to NONE when we are in locked mode
@@ -314,6 +321,68 @@
314 return false;321 return false;
315 }322 }
316323
324 /* DPI constants taken from gnome-settings-daemon/plugins/xsettings/gsd-xsettings-manager.c */
325 private const int DPI_FALLBACK = 96;
326 /* The minimum resolution at which we turn on a window-scale of 2 */
327 private const int HIDPI_LIMIT = (DPI_FALLBACK * 2);
328 /* The minimum screen height at which we turn on a window-scale of 2;
329 * below this there just isn't enough vertical real estate for GNOME
330 * apps to work, and it's better to just be tiny */
331 private const int HIDPI_MIN_HEIGHT = 1200;
332 private const int SMALLEST_4K_WIDTH = 3656;
333
334 void compute_scale_factor ()
335 {
336 var desktop_settings = new GLib.Settings ("org.gnome.desktop.interface");
337 var desktop_scale = desktop_settings.get_int ("scaling-factor");
338 if (desktop_scale > 0) {
339 scale_factor = desktop_scale;
340 } else {
341 weak Gdk.Display? display = Gdk.Display.get_default ();
342 weak Gdk.Screen screen = display.get_default_screen ();
343 var primary = screen.get_primary_monitor ();
344 var rect = Gdk.Rectangle ();
345 screen.get_monitor_geometry (primary, out rect);
346 var monitor_scale = screen.get_monitor_scale_factor (primary);
347
348 int width = rect.width * monitor_scale;
349 int height = rect.height * monitor_scale;
350 int width_mm = screen.get_monitor_width_mm (primary);
351 int height_mm = screen.get_monitor_height_mm (primary);
352
353 if (height < HIDPI_MIN_HEIGHT)
354 {
355 scale_factor = 1;
356 return;
357 }
358
359 /* Somebody encoded the aspect ratio (16/9 or 16/10)
360 * instead of the physical size */
361 if ((width_mm == 160 && height_mm == 90) ||
362 (width_mm == 160 && height_mm == 100) ||
363 (width_mm == 16 && height_mm == 9) ||
364 (width_mm == 16 && height_mm == 10))
365 {
366 scale_factor = 1;
367 return;
368 }
369
370 if (width_mm > 0 && height_mm > 0) {
371 var dpi_x = (double)width / (width_mm / 25.4);
372 var dpi_y = (double)height / (height_mm / 25.4);
373 /* We don't completely trust these values so both
374 must be high, and never pick higher ratio than
375 2 automatically */
376 if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT) {
377 scale_factor = 2;
378 return;
379 }
380 }
381
382 scale_factor = 1;
383 }
384 }
385
317 void configure_hotcorners ()386 void configure_hotcorners ()
318 {387 {
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 ());

Subscribers

People subscribed via source and target branches