Skip to content

Commit

Permalink
Merge pull request #37 from Khiro95/dev
Browse files Browse the repository at this point in the history
Patch v3.3.1
  • Loading branch information
Khiro95 authored Oct 10, 2024
2 parents 678be61 + 4823d60 commit e4fb788
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion AwqatSalaat.WinUI.MSIX/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="Khiro.AwqatSalaatWinUI"
Publisher="CN=C005A407-3926-439C-B560-3187F3293A86"
Version="3.3.0.0" />
Version="3.3.1.0" />

<Properties>
<DisplayName>Awqat Salaat WinUI</DisplayName>
Expand Down
6 changes: 5 additions & 1 deletion AwqatSalaat.WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ protected override void OnLaunched(LaunchActivatedEventArgs args)
catch (WidgetNotInjectedException ex)
{
ShowError(ex.Message);
Environment.Exit(ExitCodes.CouldNotInjectWidget);
// Calling Environment.Exit(ExitCodes.CouldNotInjectWidget) directly make the widget crash for some reason.
// The workaround is to call Exit() then asynchonously call Environment.Exit(ExitCodes.CouldNotInjectWidget)
// to override exit code; otherwise exit code will be 0x0
Exit();
System.Threading.Tasks.Task.Delay(50).ContinueWith(task => Environment.Exit(ExitCodes.CouldNotInjectWidget));
}
}

Expand Down
14 changes: 7 additions & 7 deletions AwqatSalaat.WinUI/TaskBarWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ internal class TaskBarWidget : IDisposable
private const int DefaultWidgetHostWidth = 126; // 118 for the button (2 for borders) + 4 for left margin + 4 for right margin
private const int CompactWidgetHostWidth = 70; // 62 for the button (2 for borders) + 4 for left margin + 4 for right margin

private static readonly bool IsRtlUI = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;

private readonly double dpiScale;

private readonly IntPtr hwndShell;
Expand Down Expand Up @@ -204,7 +206,6 @@ private void UpdatePositionImpl(TaskbarChangeReason changeReason)
private void UpdatePositionImpl(TaskbarChangeReason changeReason, bool isCentered, bool isWidgetsEnabled)
{
int offsetX = Properties.Settings.Default.CustomPosition;
bool osRTL = System.Globalization.CultureInfo.InstalledUICulture.TextInfo.IsRightToLeft;

User32.GetWindowRect(hwndShell, out RECT taskbarRect);

Expand All @@ -216,7 +217,7 @@ private void UpdatePositionImpl(TaskbarChangeReason changeReason, bool isCentere

if (isCentered)
{
if (osRTL)
if (IsRtlUI)
{
offsetX = (widgetsButton?.CurrentBoundingRectangle.left ?? taskbarRect.right) - WidgetHostWidth;
}
Expand All @@ -227,7 +228,7 @@ private void UpdatePositionImpl(TaskbarChangeReason changeReason, bool isCentere
}
else
{
if (osRTL)
if (IsRtlUI)
{
if (widgetsButton is not null && (widgetsButton.CurrentBoundingRectangle.left - trayNotifyRect.right) < WidgetHostWidth)
{
Expand Down Expand Up @@ -264,7 +265,7 @@ private void UpdatePositionImpl(TaskbarChangeReason changeReason, bool isCentere
continue;
}

if (isCentered == osRTL)
if (isCentered == IsRtlUI)
{
offsetX = bounds.left - WidgetHostWidth;
}
Expand All @@ -281,7 +282,7 @@ private void UpdatePositionImpl(TaskbarChangeReason changeReason, bool isCentere
#endif
}

if (osRTL)
if (IsRtlUI)
{
offsetX = Math.Clamp(offsetX, trayNotifyRect.right, taskbarRect.right - WidgetHostWidth);
}
Expand Down Expand Up @@ -398,9 +399,8 @@ private void Content_PointerMoved(object sender, PointerRoutedEventArgs e)
User32.GetCursorPos(out var lpPoint);

int minCursorX, maxCursorX;
bool osRTL = System.Globalization.CultureInfo.InstalledUICulture.TextInfo.IsRightToLeft;

if (osRTL)
if (IsRtlUI)
{
minCursorX = trayNotifyRect.right + draggingInnerOffsetX;
maxCursorX = taskbarRect.right - WidgetHostWidth + draggingInnerOffsetX;
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.ar.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
### نسخة v3.3
### نسخة v3.3.1

- إصلاح تعطل الأداة عند الفشل في إقحامها داخل شريط المهام. (نسخة WinUI فقط)
- إصلاح خلل في معرفة لغة العرض للويندوز. (نسخة WinUI فقط)

### نسخة v3.3

- جعل الأداة متوفرة على متجر مايكروسوفت. (نسخة WinUI فقط)
- تمكين سحب الأداة إلى موقع مخصص. (نسخة WinUI فقط)
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v3.3.1

- Fix crashing after failing to inject the widget into the taskbar. (WinUI only)
- Fix bug of wrong detection of Windows display language. (WinUI only)

### v3.3

- Make the widget available on Microsoft Store. (WinUI only)
Expand Down
2 changes: 1 addition & 1 deletion README.ar.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
> [!note]
> بالرغم من أن التطبيق يمكن أن يعمل على نظام ويندوز 10 إلا أنه *لا ينصح به* بسبب محدوديته في بعض الجوانب كما هو مذكور في الأسفل، لذا يستحسن استعمال أداة deskband.
#### المتطلبات
#### المتطلبات (غير ضرورية لنسخة متجر مايكروسوفت)

- [.NET Desktop Runtime 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
- [Windows App Runtime 1.5](https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This app bring Awqat Salaat to Windows 11 which wasn't supported in earlier vers
> [!note]
> Although this app can run on Windows 10, it's *not recommended* due to the limitiations listed below, use deskband widget instead.
#### Requirements
#### Requirements (NOT necessary for Microsoft Store version)

- [.NET Desktop Runtime 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
- [Windows App Runtime 1.5](https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads)
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "3.3.0",
"version": "3.3.1",
"assemblyVersion": "3.0",
"versionHeightOffset": -1,
"pathFilters": [ "/AwqatSalaat", "/AwqatSalaat.Common", "/AwqatSalaat.WinUI" ],
Expand Down

0 comments on commit e4fb788

Please sign in to comment.