Skip to content

Commit fcfe1bf

Browse files
committed
Increase modifier overlay chip size
1 parent 011e84f commit fcfe1bf

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

src/SwitchifyPc.Windows/ModifierOverlay/WindowsModifierKeyOverlayNotifier.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,13 @@ private sealed class OverlayForm : Forms.Form
124124
{
125125
private const int MarginPx = 16;
126126
private const int PaddingPx = 14;
127-
private const int ChipPaddingX = 12;
128-
private const int ChipHeight = 28;
127+
private const int ChipPaddingX = 14;
128+
private const int ChipHeight = 32;
129129
private const int GapPx = 8;
130130
private static readonly Color PanelColor = Color.FromArgb(0x1F, 0x1F, 0x23);
131131
private static readonly Color BrandRed = Color.FromArgb(0xD3, 0x2F, 0x2F);
132132
private readonly IWindowsNativeInput nativeInput;
133+
private readonly Font chipFont;
133134

134135
public OverlayForm(IWindowsNativeInput nativeInput)
135136
{
@@ -146,6 +147,7 @@ public OverlayForm(IWindowsNativeInput nativeInput)
146147
ShowInTaskbar = false;
147148
StartPosition = Forms.FormStartPosition.Manual;
148149
TopMost = true;
150+
chipFont = new Font(Font.FontFamily, 9.5f, FontStyle.Bold);
149151
}
150152

151153
protected override bool ShowWithoutActivation => true;
@@ -177,16 +179,16 @@ public void SetActiveModifiers(IReadOnlyList<string> activeModifiers)
177179
int x = PaddingPx;
178180
foreach (string label in activeModifiers)
179181
{
180-
SizeF textSize = graphics.MeasureString(label, Font);
181-
int width = (int)Math.Ceiling(textSize.Width) + ChipPaddingX * 2;
182+
SizeF textSize = graphics.MeasureString(label, chipFont);
183+
int width = (int)Math.Ceiling(textSize.Width) + ChipPaddingX * 2 + 2;
182184
Forms.Label chip = new()
183185
{
184186
AutoSize = false,
185187
BackColor = BrandRed,
186188
ForeColor = Color.White,
187189
Text = label,
188190
TextAlign = ContentAlignment.MiddleCenter,
189-
Font = new Font(Font.FontFamily, 9.0f, FontStyle.Bold),
191+
Font = chipFont,
190192
Bounds = new Rectangle(x, PaddingPx, width, ChipHeight)
191193
};
192194
Controls.Add(chip);
@@ -215,6 +217,16 @@ protected override void OnPaint(Forms.PaintEventArgs e)
215217
e.Graphics.DrawPath(border, RoundedRectangle(new Rectangle(0, 0, ClientSize.Width - 1, ClientSize.Height - 1), 8));
216218
}
217219

220+
protected override void Dispose(bool disposing)
221+
{
222+
if (disposing)
223+
{
224+
chipFont.Dispose();
225+
}
226+
227+
base.Dispose(disposing);
228+
}
229+
218230
private void Reposition()
219231
{
220232
PointerPosition cursor = nativeInput.GetCursorPosition();

0 commit comments

Comments
 (0)