Skip to content

Commit

Permalink
remember last position of notification window (fix #1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrypp committed May 26, 2024
1 parent 177b34a commit 0bf1623
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/notifications.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ VOID _app_notify_setposition (

if (!is_forced && _r_wnd_isvisible (hwnd, FALSE))
{
_r_wnd_adjustrectangletoworkingarea (&window_rect, NULL);
_r_wnd_adjustrectangletoworkingarea (&window_rect, hwnd);
_r_wnd_setposition (hwnd, &window_rect.position, NULL);

return;
Expand Down Expand Up @@ -861,7 +861,7 @@ VOID _app_notify_drawgradient (
gradient_rect.LowerRight = 1;
//gradient_rect.UpperLeft = 0;

for (ULONG i = 0; i < RTL_NUMBER_OF (trivertx); i++)
for (ULONG_PTR i = 0; i < RTL_NUMBER_OF (trivertx); i++)
{
trivertx[i].Red = GetRValue (gradient_arr[i]) << 8;
trivertx[i].Green = GetGValue (gradient_arr[i]) << 8;
Expand Down Expand Up @@ -912,6 +912,8 @@ INT_PTR CALLBACK NotificationProc (
// set correct position
_app_notify_setposition (hwnd, FALSE);

_r_window_restoreposition (hwnd, L"notification");

dpi_value = _r_dc_getwindowdpi (hwnd);

_app_notify_initialize (context, dpi_value);
Expand Down Expand Up @@ -949,6 +951,12 @@ INT_PTR CALLBACK NotificationProc (
break;
}

case WM_DESTROY:
{
_r_window_saveposition (hwnd, L"notification");
break;
}

case WM_NCDESTROY:
{
_InterlockedCompareExchangePointer (&config.hnotification, NULL, config.hnotification);
Expand Down Expand Up @@ -1122,7 +1130,7 @@ INT_PTR CALLBACK NotificationProc (

if (ctrl_id == IDC_FILE_TEXT)
{
SetCursor (LoadCursor (NULL, IDC_HAND));
SetCursor (LoadCursorW (NULL, IDC_HAND));

SetWindowLongPtrW (hwnd, DWLP_MSGRESULT, TRUE);

Expand Down

0 comments on commit 0bf1623

Please sign in to comment.