https://git.reactos.org/?p=reactos.git;a=commitdiff;h=06f57e169635f5d05bee8…
commit 06f57e169635f5d05bee8412a2bd46325ac7a209
Author: Arnav Bhatt <arnavbhatt288(a)gmail.com>
AuthorDate: Sat Mar 6 18:13:05 2021 +0000
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Mar 6 19:13:05 2021 +0100
initial commit (#3506)
---
dll/win32/msgina/shutdown.c | 24 ++++++++++++++++--------
dll/win32/shell32/dialogs/dialogs.cpp | 24 ++++++++++++++++--------
dll/win32/shell32/lang/pl-PL.rc | 18 +++++++++---------
3 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/dll/win32/msgina/shutdown.c b/dll/win32/msgina/shutdown.c
index 8f319db0a74..6ea696d5031 100644
--- a/dll/win32/msgina/shutdown.c
+++ b/dll/win32/msgina/shutdown.c
@@ -396,12 +396,6 @@ DrawIconOnOwnerDrawnButtons(
}
}
- /* If the owner draw button has keyboard focus make it the default button */
- if (pdis->itemState & ODS_FOCUS)
- {
- SendMessageW(GetParent(pdis->hwndItem), DM_SETDEFID, pdis->CtlID, 0);
- }
-
/* Draw it on the required button */
bRet = BitBlt(pdis->hDC,
(rect.right - rect.left - CX_BITMAP) / 2,
@@ -502,7 +496,7 @@ LoadShutdownSelState(VOID)
static INT_PTR
CALLBACK
-HotButtonSubclass(
+OwnerDrawButtonSubclass(
HWND hButton,
UINT uMsg,
WPARAM wParam,
@@ -568,6 +562,20 @@ HotButtonSubclass(
InvalidateRect(hButton, NULL, FALSE);
break;
}
+
+ /* Whenever one of the buttons gets the keyboard focus, set it as default button
*/
+ case WM_SETFOCUS:
+ {
+ SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
+ break;
+ }
+
+ /* Otherwise, set IDCANCEL as default button */
+ case WM_KILLFOCUS:
+ {
+ SendMessageW(GetParent(hButton), DM_SETDEFID, IDCANCEL, 0);
+ break;
+ }
}
return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
}
@@ -968,7 +976,7 @@ ShutdownOnInit(
for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
{
SetWindowLongPtrW(GetDlgItem(hDlg, IDC_BUTTON_HIBERNATE + i), GWLP_USERDATA,
(LONG_PTR)pContext);
- SetWindowLongPtrW(GetDlgItem(hDlg, IDC_BUTTON_HIBERNATE + i), GWLP_WNDPROC,
(LONG_PTR)HotButtonSubclass);
+ SetWindowLongPtrW(GetDlgItem(hDlg, IDC_BUTTON_HIBERNATE + i), GWLP_WNDPROC,
(LONG_PTR)OwnerDrawButtonSubclass);
}
/* Update the choice description based on the current selection */
diff --git a/dll/win32/shell32/dialogs/dialogs.cpp
b/dll/win32/shell32/dialogs/dialogs.cpp
index 3fbdf639aa4..2094bc8d188 100644
--- a/dll/win32/shell32/dialogs/dialogs.cpp
+++ b/dll/win32/shell32/dialogs/dialogs.cpp
@@ -1169,12 +1169,6 @@ BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT* pdis,
PLOGOFF_DLG_CONTEXT pCont
}
}
- /* If the owner draw button has keyboard focus make it the default button */
- if (pdis->itemState & ODS_FOCUS)
- {
- SendMessageW(GetParent(pdis->hwndItem), DM_SETDEFID, pdis->CtlID, 0);
- }
-
/* Draw it on the required button */
bRet = BitBlt(pdis->hDC,
(rect.right - rect.left - CX_BITMAP) / 2,
@@ -1187,7 +1181,7 @@ BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT* pdis,
PLOGOFF_DLG_CONTEXT pCont
return bRet;
}
-INT_PTR CALLBACK HotButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM
lParam)
+INT_PTR CALLBACK OwnerDrawButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM
lParam)
{
PLOGOFF_DLG_CONTEXT pContext;
pContext = (PLOGOFF_DLG_CONTEXT)GetWindowLongPtrW(hButton, GWLP_USERDATA);
@@ -1233,6 +1227,20 @@ INT_PTR CALLBACK HotButtonSubclass(HWND hButton, UINT uMsg, WPARAM
wParam, LPARA
InvalidateRect(hButton, NULL, FALSE);
break;
}
+
+ /* Whenever one of the buttons gets the keyboard focus, set it as default button
*/
+ case WM_SETFOCUS:
+ {
+ SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
+ break;
+ }
+
+ /* Otherwise, set IDCANCEL as default button */
+ case WM_KILLFOCUS:
+ {
+ SendMessageW(GetParent(hButton), DM_SETDEFID, IDCANCEL, 0);
+ break;
+ }
}
return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
}
@@ -1366,7 +1374,7 @@ static VOID FancyLogoffOnInit(HWND hwnd, PLOGOFF_DLG_CONTEXT
pContext)
{
pContext->bIsButtonHot[i] = FALSE;
SetWindowLongPtrW(GetDlgItem(hwnd, IDC_LOG_OFF_BUTTON + i), GWLP_USERDATA,
(LONG_PTR)pContext);
- SetWindowLongPtrW(GetDlgItem(hwnd, IDC_LOG_OFF_BUTTON + i), GWLP_WNDPROC,
(LONG_PTR)HotButtonSubclass);
+ SetWindowLongPtrW(GetDlgItem(hwnd, IDC_LOG_OFF_BUTTON + i), GWLP_WNDPROC,
(LONG_PTR)OwnerDrawButtonSubclass);
}
}
diff --git a/dll/win32/shell32/lang/pl-PL.rc b/dll/win32/shell32/lang/pl-PL.rc
index 49802558c64..ce3cb3a85f0 100644
--- a/dll/win32/shell32/lang/pl-PL.rc
+++ b/dll/win32/shell32/lang/pl-PL.rc
@@ -499,18 +499,18 @@ BEGIN
PUSHBUTTON "Anuluj", IDCANCEL, 95, 39, 50, 14
END
-IDD_LOG_OFF_FANCY DIALOGEX 0, 0, 208, 122
+IDD_LOG_OFF_FANCY DIALOGEX 0, 0, 278, 122
STYLE NOT WS_VISIBLE | DS_CENTER | DS_SHELLFONT | WS_BORDER | WS_POPUP
FONT 8, "MS Shell Dlg"
BEGIN
- CONTROL IDB_DLG_BG, IDC_STATIC, "STATIC", SS_BITMAP | SS_REALSIZECONTROL,
0, 0, 208, 122
- CONTROL IDB_REACTOS_FLAG, IDC_STATIC, "STATIC", SS_BITMAP, 176, 1, 32, 26
- PUSHBUTTON "&Przełącz użytkownika", IDC_SWITCH_USER_BUTTON, 55, 46, 22,
20, BS_OWNERDRAW | WS_DISABLED | WS_GROUP
- PUSHBUTTON "&Wyloguj", IDC_LOG_OFF_BUTTON, 132, 46, 22, 20,
BS_OWNERDRAW
- PUSHBUTTON "Anuluj", IDCANCEL, 162, 103, 40, 12, WS_GROUP | BS_FLAT
- LTEXT "Wylogowywanie z systemu ReactOS", IDC_LOG_OFF_TEXT_STATIC, 4, 7,
170, 19
- CTEXT "Przełącz użytkownika", IDC_SWITCH_USER_STATIC, 41, 70, 51, 11
- CTEXT "Wyloguj", IDC_LOG_OFF_STATIC, 118, 70, 51, 11
+ CONTROL IDB_DLG_BG, IDC_STATIC, "STATIC", SS_BITMAP | SS_REALSIZECONTROL,
0, 0, 278, 122
+ CONTROL IDB_REACTOS_FLAG, IDC_STATIC, "STATIC", SS_BITMAP, 245, 1, 32, 26
+ PUSHBUTTON "&Przełącz użytkownika", IDC_SWITCH_USER_BUTTON, 86, 46, 22,
20, BS_OWNERDRAW | WS_GROUP
+ PUSHBUTTON "&Wyloguj", IDC_LOG_OFF_BUTTON, 169, 46, 22, 20,
BS_OWNERDRAW
+ PUSHBUTTON "Anuluj", IDCANCEL, 232, 103, 40, 12, WS_GROUP | BS_FLAT
+ LTEXT "Wylogowywanie z systemu ReactOS", IDC_LOG_OFF_TEXT_STATIC, 4, 7,
232, 19
+ CTEXT "Przełącz użytkownika", IDC_SWITCH_USER_STATIC, 52, 70, 90, 11
+ CTEXT "Wyloguj", IDC_LOG_OFF_STATIC, 155, 70, 51, 11
END
IDD_DISCONNECT DIALOGEX 0, 0, 188, 60