Skip to content

Commit e795cc1

Browse files
authored
WindowSwitcher: correctly draw border on HiDPI (#2423)
1 parent 2fe4ceb commit e795cc1

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Widgets/WindowSwitcher/WindowSwitcher.vala

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
167167
highlight_color = Drawing.Color.DARK_HIGHLIGHT;
168168
}
169169

170-
var stroke_width = scaling_factor;
171-
172170
#if HAS_MUTTER47
173171
caption.color = Cogl.Color.from_string (caption_color);
174172
#else
@@ -183,11 +181,11 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
183181

184182
ctx.set_operator (Cairo.Operator.SOURCE);
185183

186-
// Offset by 0.5 so cairo draws a stroke on real pixels
184+
var stroke_width = Utils.scale_to_int (1, scaling_factor);
187185
Drawing.Utilities.cairo_rounded_rectangle (
188-
ctx, 0.5, 0.5,
189-
width - stroke_width,
190-
height - stroke_width,
186+
ctx,
187+
stroke_width / 2.0, stroke_width / 2.0,
188+
width - stroke_width, height - stroke_width,
191189
Utils.scale_to_int (9, scaling_factor)
192190
);
193191

@@ -209,11 +207,10 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
209207
ctx.stroke ();
210208
ctx.restore ();
211209

212-
// Offset by 0.5 so cairo draws a stroke on real pixels
213210
Drawing.Utilities.cairo_rounded_rectangle (
214-
ctx, stroke_width + 0.5, stroke_width + 0.5,
215-
width - stroke_width * 2 - 1,
216-
height - stroke_width * 2 - 1,
211+
ctx, stroke_width * 1.5, stroke_width * 1.5,
212+
width - stroke_width * 3,
213+
height - stroke_width * 3,
217214
Utils.scale_to_int (8, scaling_factor)
218215
);
219216

0 commit comments

Comments
 (0)