Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,48 @@ private void UpdateWindowPosition()
// PInvoke.SHAppBarMessage(ABM_SETSTATE, ref _appBarData);
// PInvoke.SHAppBarMessage(PInvoke.ABM_SETAUTOHIDEBAR, ref _appBarData);

// Account for system borders when moving the window
// Adjust position to account for window frame/border
var adjustedLeft = _appBarData.rc.left - frameWidth;
var adjustedTop = _appBarData.rc.top - frameWidth;
var adjustedWidth = (_appBarData.rc.right - _appBarData.rc.left) + (2 * frameWidth);
var adjustedHeight = (_appBarData.rc.bottom - _appBarData.rc.top) + (2 * frameWidth);
// Expand the window by the invisible DWM frame on the sides that face
// away from the work area (off-screen or the screen edge). The edge
// that faces the work area must stay exactly at _appBarData.rc so that
// snapped windows do not overlap the visible dock surface.
int adjustedLeft, adjustedTop, adjustedWidth, adjustedHeight;
switch (_settings.Side)
{
case DockSide.Top:
// Bottom edge faces the work area — do not extend it.
adjustedLeft = _appBarData.rc.left - frameWidth;
adjustedTop = _appBarData.rc.top - frameWidth;
adjustedWidth = (_appBarData.rc.right - _appBarData.rc.left) + (2 * frameWidth);
adjustedHeight = (_appBarData.rc.bottom - _appBarData.rc.top) + frameWidth;
break;
case DockSide.Bottom:
// Top edge faces the work area — do not extend it.
adjustedLeft = _appBarData.rc.left - frameWidth;
adjustedTop = _appBarData.rc.top;
adjustedWidth = (_appBarData.rc.right - _appBarData.rc.left) + (2 * frameWidth);
adjustedHeight = (_appBarData.rc.bottom - _appBarData.rc.top) + frameWidth;
break;
case DockSide.Left:
// Right edge faces the work area — do not extend it.
adjustedLeft = _appBarData.rc.left - frameWidth;
adjustedTop = _appBarData.rc.top - frameWidth;
adjustedWidth = (_appBarData.rc.right - _appBarData.rc.left) + frameWidth;
adjustedHeight = (_appBarData.rc.bottom - _appBarData.rc.top) + (2 * frameWidth);
break;
case DockSide.Right:
// Left edge faces the work area — do not extend it.
adjustedLeft = _appBarData.rc.left;
adjustedTop = _appBarData.rc.top - frameWidth;
adjustedWidth = (_appBarData.rc.right - _appBarData.rc.left) + frameWidth;
adjustedHeight = (_appBarData.rc.bottom - _appBarData.rc.top) + (2 * frameWidth);
break;
default:
adjustedLeft = _appBarData.rc.left - frameWidth;
adjustedTop = _appBarData.rc.top - frameWidth;
adjustedWidth = (_appBarData.rc.right - _appBarData.rc.left) + (2 * frameWidth);
adjustedHeight = (_appBarData.rc.bottom - _appBarData.rc.top) + (2 * frameWidth);
break;
}

// Move the actual window
PInvoke.MoveWindow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public void Unload()
".m4a",
".mp3",
".ogg",
".opus",
".wav",
".wma",
};
Expand Down
2 changes: 1 addition & 1 deletion src/modules/poweraccent/PowerAccent.Core/Languages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ private static string[] GetDefaultLetterKeyIT(LetterKey letter)
return letter switch
{
LetterKey.VK_A => new[] { "à" },
LetterKey.VK_E => new[] { "è", "é", "ə", "€" },
LetterKey.VK_E => new[] { "è", "é" },
LetterKey.VK_I => new[] { "ì", "í" },
LetterKey.VK_O => new[] { "ò", "ó" },
LetterKey.VK_U => new[] { "ù", "ú" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,20 +589,33 @@ private void LoadMachineMatrixString()

if (!string.IsNullOrEmpty(Settings.Properties.MachinePool?.Value))
{
List<string> availableMachines = new List<string>();

// Format of this field is "NAME1:ID1,NAME2:ID2,..."
// Load the available machines
// Build a deduplicated list of available machine names so that a machine
// registered under multiple IDs doesn't produce duplicate layout slots.
var seenPool = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
List<string> availableMachines = new List<string>();
foreach (string availableMachineIdPair in Settings.Properties.MachinePool.Value.Split(","))
{
string availableMachineName = availableMachineIdPair.Split(':')[0];
availableMachines.Add(availableMachineName);
if (seenPool.Add(availableMachineName))
{
availableMachines.Add(availableMachineName);
}
}

// Start by removing the machines from the matrix that are no longer available to pick.
// Remove machines from the matrix that are no longer available, and clear
// any duplicate entries that may have been persisted in earlier versions.
var seenInMatrix = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
for (int i = 0; i < loadMachineMatrixString.Count; i++)
{
if (!availableMachines.Contains(loadMachineMatrixString[i]))
if (string.IsNullOrEmpty(loadMachineMatrixString[i]))
{
continue;
}

bool stillAvailable = availableMachines.Contains(loadMachineMatrixString[i], StringComparer.OrdinalIgnoreCase);
bool firstOccurrence = seenInMatrix.Add(loadMachineMatrixString[i]);
if (!stillAvailable || !firstOccurrence)
{
editedTheMatrix = true;
loadMachineMatrixString[i] = string.Empty;
Expand All @@ -612,7 +625,7 @@ private void LoadMachineMatrixString()
// If an available machine is not in the matrix already, fill it in the first available spot.
foreach (string availableMachineName in availableMachines)
{
if (!loadMachineMatrixString.Contains(availableMachineName))
if (!loadMachineMatrixString.Contains(availableMachineName, StringComparer.OrdinalIgnoreCase))
{
int availableIndex = loadMachineMatrixString.FindIndex(name => string.IsNullOrEmpty(name));
if (availableIndex >= 0)
Expand Down
Loading