Skip to content

Commit d149859

Browse files
committed
Merge remote-tracking branch 'origin/main' into ffb-stack
# Conflicts: # MarvinsAIRARefactored/Resources/Resources.ar-SA.resx # MarvinsAIRARefactored/Resources/Resources.bg-BG.resx # MarvinsAIRARefactored/Resources/Resources.ca-ES.resx # MarvinsAIRARefactored/Resources/Resources.cs-CZ.resx # MarvinsAIRARefactored/Resources/Resources.cy-GB.resx # MarvinsAIRARefactored/Resources/Resources.da-DK.resx # MarvinsAIRARefactored/Resources/Resources.de-DE.resx # MarvinsAIRARefactored/Resources/Resources.es-ES.resx # MarvinsAIRARefactored/Resources/Resources.es-MX.resx # MarvinsAIRARefactored/Resources/Resources.et-EE.resx # MarvinsAIRARefactored/Resources/Resources.fi-FI.resx # MarvinsAIRARefactored/Resources/Resources.fr-CA.resx # MarvinsAIRARefactored/Resources/Resources.fr-FR.resx # MarvinsAIRARefactored/Resources/Resources.he-IL.resx # MarvinsAIRARefactored/Resources/Resources.hi-IN.resx # MarvinsAIRARefactored/Resources/Resources.hu-HU.resx # MarvinsAIRARefactored/Resources/Resources.hy-AM.resx # MarvinsAIRARefactored/Resources/Resources.it-IT.resx # MarvinsAIRARefactored/Resources/Resources.ja-JP.resx # MarvinsAIRARefactored/Resources/Resources.ko-KR.resx # MarvinsAIRARefactored/Resources/Resources.lv-LV.resx # MarvinsAIRARefactored/Resources/Resources.nb-NO.resx # MarvinsAIRARefactored/Resources/Resources.nl-NL.resx # MarvinsAIRARefactored/Resources/Resources.pl-PL.resx # MarvinsAIRARefactored/Resources/Resources.pt-BR.resx # MarvinsAIRARefactored/Resources/Resources.pt-PT.resx # MarvinsAIRARefactored/Resources/Resources.resx # MarvinsAIRARefactored/Resources/Resources.ro-RO.resx # MarvinsAIRARefactored/Resources/Resources.ru-RU.resx # MarvinsAIRARefactored/Resources/Resources.sk-SK.resx # MarvinsAIRARefactored/Resources/Resources.sv-SE.resx # MarvinsAIRARefactored/Resources/Resources.th-TH.resx # MarvinsAIRARefactored/Resources/Resources.tr-TR.resx # MarvinsAIRARefactored/Resources/Resources.uk-UA.resx # MarvinsAIRARefactored/Resources/Resources.zh-Hans.resx # MarvinsAIRARefactored/Resources/Resources.zh-Hant.resx
2 parents 873bd82 + 1358965 commit d149859

41 files changed

Lines changed: 258 additions & 11 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MarvinsAIRARefactored/Classes/Misc.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,37 @@ public static Dictionary<string, string> LoadResxFromStream( Stream stream )
213213
return dictionary;
214214
}
215215

216-
public static bool IsWindowBoundsVisible( Rectangle bounds )
216+
private const double WindowTitleBarHeightInDIPs = 32.0;
217+
218+
// Tests whether enough of the window's title bar is on a screen for the user to grab it with the
219+
// mouse. Both the bounds and the screen working areas are in physical pixels - convert WPF DIPs
220+
// using the window's DPI scale before calling (they diverge whenever any monitor is not at 100%
221+
// scaling). Screens are tested individually rather than against the virtual desktop bounding box,
222+
// so the dead zones of non-rectangular multi-monitor layouts correctly count as off-screen.
223+
public static bool IsWindowTitleBarVisible( Rectangle boundsInPixels, double dpiScale )
217224
{
218-
var totalWindowArea = bounds.Width * bounds.Height;
219-
220-
if ( totalWindowArea <= 0 )
225+
if ( ( boundsInPixels.Width <= 0 ) || ( boundsInPixels.Height <= 0 ) )
221226
{
222227
return false;
223228
}
224229

230+
var titleBarHeightInPixels = Math.Max( 1, (int) Math.Round( WindowTitleBarHeightInDIPs * dpiScale ) );
231+
232+
var titleBarBounds = new Rectangle( boundsInPixels.X, boundsInPixels.Y, boundsInPixels.Width, titleBarHeightInPixels );
233+
234+
var totalTitleBarArea = titleBarBounds.Width * titleBarBounds.Height;
235+
225236
var totalVisibleArea = 0;
226237

227238
foreach ( var screen in Screen.AllScreens )
228239
{
229-
var intersection = Rectangle.Intersect( screen.WorkingArea, bounds );
240+
var intersection = Rectangle.Intersect( screen.WorkingArea, titleBarBounds );
230241

231242
totalVisibleArea += intersection.Width * intersection.Height;
232243
}
233244

234-
// Require at least 10% of the window to be visible on screen
235-
return totalVisibleArea >= totalWindowArea * 0.10;
245+
// Require at least 25% of the title bar to be visible so there is enough of it to grab
246+
return totalVisibleArea >= totalTitleBarArea * 0.25;
236247
}
237248

238249
public static void BringExistingInstanceToFront()

MarvinsAIRARefactored/DataContext/Settings.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15484,6 +15484,30 @@ public Rectangle AppWindowPositionAndSize
1548415484

1548515485
#endregion
1548615486

15487+
#region App - Window DPI scale
15488+
15489+
// The DPI scale of the monitor the main window was on when AppWindowPositionAndSize was saved.
15490+
// AppWindowPositionAndSize is stored in WPF DIPs; this scale converts it back to physical pixels
15491+
// so the saved bounds can be tested against the physical screen working areas at startup.
15492+
private double _appWindowDpiScale = 1.0;
15493+
15494+
public double AppWindowDpiScale
15495+
{
15496+
get => _appWindowDpiScale;
15497+
15498+
set
15499+
{
15500+
if ( value != _appWindowDpiScale )
15501+
{
15502+
_appWindowDpiScale = value;
15503+
15504+
OnPropertyChanged();
15505+
}
15506+
}
15507+
}
15508+
15509+
#endregion
15510+
1548715511
#region App - Start with Windows
1548815512

1548915513
private bool _appStartWithWindows = false;

MarvinsAIRARefactored/Resources/Resources.ar-SA.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,8 @@
18311831
<value>تمكين موضع وحجم التراكب لكل سيارة</value>
18321832
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18331833
<value>ملف المعايرة غير متوفر بعد لهذه السيارة.</value>
1834+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1835+
<value>إعادة تعيين موضع النافذة</value>
18341836
</data>
18351837
<data name="FFBModuleSource60Hz" xml:space="preserve">
18361838
<value>مصدر 60 Hz</value>

MarvinsAIRARefactored/Resources/Resources.bg-BG.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,8 @@
18311831
<value>Активиране на позиция и мащаб на наслагването за всяка кола</value>
18321832
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18331833
<value>Файлът за калибриране все още не е наличен за тази кола.</value>
1834+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1835+
<value>Нулиране на позицията на прозореца</value>
18341836
</data>
18351837
<data name="FFBModuleSource60Hz" xml:space="preserve">
18361838
<value>Източник 60 Hz</value>

MarvinsAIRARefactored/Resources/Resources.ca-ES.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,8 @@
18311831
<value>Activa la posició i l'escala de la superposició per cotxe</value>
18321832
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18331833
<value>El fitxer de calibració encara no està disponible per a aquest cotxe.</value>
1834+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1835+
<value>Restableix la posició de la finestra</value>
18341836
</data>
18351837
<data name="FFBModuleSource60Hz" xml:space="preserve">
18361838
<value>Font de 60 Hz</value>

MarvinsAIRARefactored/Resources/Resources.cs-CZ.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,8 @@
18311831
<value>Povolit pozici a měřítko překryvu pro každé auto</value>
18321832
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18331833
<value>Kalibrační soubor pro toto auto zatím není k dispozici.</value>
1834+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1835+
<value>Obnovit pozici okna</value>
18341836
</data>
18351837
<data name="FFBModuleSource60Hz" xml:space="preserve">
18361838
<value>Zdroj 60 Hz</value>

MarvinsAIRARefactored/Resources/Resources.cy-GB.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,8 @@
18311831
<value>Galluogi safle a graddfa haen fesul car</value>
18321832
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18331833
<value>Nid yw'r ffeil galibradu ar gael eto ar gyfer y car hwn.</value>
1834+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1835+
<value>Ailosod safle ffenestr</value>
18341836
</data>
18351837
<data name="FFBModuleSource60Hz" xml:space="preserve">
18361838
<value>Ffynhonnell 60 Hz</value>

MarvinsAIRARefactored/Resources/Resources.da-DK.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,8 @@
18311831
<value>Aktivér overlay-position og -skalering pr. bil</value>
18321832
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18331833
<value>Kalibreringsfilen er endnu ikke tilgængelig for denne bil.</value>
1834+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1835+
<value>Nulstil vinduets position</value>
18341836
</data>
18351837
<data name="FFBModuleSource60Hz" xml:space="preserve">
18361838
<value>60 Hz kilde</value>

MarvinsAIRARefactored/Resources/Resources.de-DE.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,8 @@ Hier ist der Link zum Spenden:</value>
18341834
<value>Overlay-Position und -Skalierung pro Auto aktivieren</value>
18351835
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18361836
<value>Die Kalibrierungsdatei ist für dieses Auto noch nicht verfügbar.</value>
1837+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1838+
<value>Fensterposition zurücksetzen</value>
18371839
</data>
18381840
<data name="FFBModuleSource60Hz" xml:space="preserve">
18391841
<value>60-Hz-Quelle</value>

MarvinsAIRARefactored/Resources/Resources.es-ES.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,8 @@
18311831
<value>Activar la posición y la escala de superposición por coche</value>
18321832
</data> <data name="SteeringEffectsCalibrationFileNotAvailable" xml:space="preserve">
18331833
<value>El archivo de calibración aún no está disponible para este coche.</value>
1834+
</data> <data name="ResetWindowPosition" xml:space="preserve">
1835+
<value>Restablecer posición de la ventana</value>
18341836
</data>
18351837
<data name="FFBModuleSource60Hz" xml:space="preserve">
18361838
<value>Fuente de 60 Hz</value>

0 commit comments

Comments
 (0)