ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2024
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
128 discussions
Start a n
N
ew thread
[reactos] 01/01: [SDK] cicutf.h: s/OnPointingEnded/OnMouseOutFromWindow/ (#6461)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3581a79ebf1f86b9f90c6…
commit 3581a79ebf1f86b9f90c6e8e2a971223e7e7b905 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Feb 8 14:13:59 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Feb 8 14:13:59 2024 +0900 [SDK] cicutf.h: s/OnPointingEnded/OnMouseOutFromWindow/ (#6461) Supporting Language Bar... JIRA issue: CORE-19363 Renaming method. --- sdk/include/reactos/cicero/cicuif.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index ba9e9d8ab42..614a5aa2808 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -592,7 +592,7 @@ public: STDMETHOD_(void, Move)(INT x, INT y, INT nWidth, INT nHeight); STDMETHOD_(BOOL, AnimateWnd)(DWORD dwTime, DWORD dwFlags); STDMETHOD_(void, OnObjectMoved)(CUIFObject *pObject); - STDMETHOD_(void, OnPointingEnded)(LONG x, LONG y) { } + STDMETHOD_(void, OnMouseOutFromWindow)(LONG x, LONG y) { } STDMETHOD_(void, OnCreate)(HWND hWnd) { } STDMETHOD_(void, OnDestroy)(HWND hWnd) { } STDMETHOD_(void, OnNCDestroy)(HWND hWnd) { } @@ -2976,7 +2976,7 @@ CUIFWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ::KillTimer(m_hWnd, POINTING_TIMER_ID); m_bPointing = FALSE; SetObjectPointed(NULL, pt2); - OnPointingEnded(pt2.x, pt2.y); + OnMouseOutFromWindow(pt2.x, pt2.y); } if (m_pToolTip)
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [NTOS:FSTUB] Pack the MASTER_BOOT_RECORD structure (#6416)
by Adam Słaboń
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1f28f715ba14d2f3c99e0…
commit 1f28f715ba14d2f3c99e016a1a9e5e710d2b6809 Author: Adam Słaboń <asaillen(a)protonmail.com> AuthorDate: Wed Feb 7 23:02:19 2024 +0100 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Feb 8 01:02:19 2024 +0300 [NTOS:FSTUB] Pack the MASTER_BOOT_RECORD structure (#6416) Otherwise the USHORT members are aligned to 4-byte boundary space which overflows the disk sector buffer and ultimately results in crash. This can be reproduced by trying to format the USB drive with Rufus. Also put some additional C_ASSERT checks for extra safety. --- ntoskrnl/fstub/fstubex.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ntoskrnl/fstub/fstubex.c b/ntoskrnl/fstub/fstubex.c index 1904d32339a..00d4ae30fd4 100644 --- a/ntoskrnl/fstub/fstubex.c +++ b/ntoskrnl/fstub/fstubex.c @@ -41,6 +41,7 @@ typedef struct _EFI_PARTITION_HEADER ULONG SizeOfPartitionEntry; // 84 ULONG PartitionEntryCRC32; // 88 } EFI_PARTITION_HEADER, *PEFI_PARTITION_HEADER; +C_ASSERT(sizeof(EFI_PARTITION_HEADER) == 92); #include <poppack.h> typedef struct _EFI_PARTITION_ENTRY @@ -52,6 +53,7 @@ typedef struct _EFI_PARTITION_ENTRY ULONGLONG Attributes; // 48 WCHAR Name[0x24]; // 56 } EFI_PARTITION_ENTRY, *PEFI_PARTITION_ENTRY; +C_ASSERT(sizeof(EFI_PARTITION_ENTRY) == 128); typedef struct _PARTITION_TABLE_ENTRY { @@ -66,7 +68,9 @@ typedef struct _PARTITION_TABLE_ENTRY ULONG SectorCountBeforePartition; ULONG PartitionSectorCount; } PARTITION_TABLE_ENTRY, *PPARTITION_TABLE_ENTRY; +C_ASSERT(sizeof(PARTITION_TABLE_ENTRY) == 16); +#include <pshpack1.h> typedef struct _MASTER_BOOT_RECORD { UCHAR MasterBootRecordCodeAndData[0x1B8]; // 0 @@ -75,6 +79,8 @@ typedef struct _MASTER_BOOT_RECORD PARTITION_TABLE_ENTRY PartitionTable[4]; // 446 USHORT MasterBootRecordMagic; // 510 } MASTER_BOOT_RECORD, *PMASTER_BOOT_RECORD; +C_ASSERT(sizeof(MASTER_BOOT_RECORD) == 512); +#include <poppack.h> /* Partition entry size (bytes) - FIXME: It's hardcoded as Microsoft does, but according to specs, it shouldn't be */ #define PARTITION_ENTRY_SIZE 128
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSUTB][SDK] Add CUTBContextMenu (#6452)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7dd33088282e7029f3a81…
commit 7dd33088282e7029f3a81f939dbd24835954f953 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Feb 7 16:47:10 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Feb 7 16:47:10 2024 +0900 [MSUTB][SDK] Add CUTBContextMenu (#6452) Supporting Language Bar... JIRA issue: CORE-19363 - Add some resource strings. - Half-implement CUTBContextMenu class. --- dll/win32/msutb/lang/en-US.rc | 10 +- dll/win32/msutb/msutb.cpp | 326 +++++++++++++++++++++++++++++++++++++++++- dll/win32/msutb/resource.h | 21 +++ sdk/include/psdk/msctf.idl | 13 +- 4 files changed, 360 insertions(+), 10 deletions(-) diff --git a/dll/win32/msutb/lang/en-US.rc b/dll/win32/msutb/lang/en-US.rc index 8b09fb014c3..97a03d501df 100644 --- a/dll/win32/msutb/lang/en-US.rc +++ b/dll/win32/msutb/lang/en-US.rc @@ -17,11 +17,19 @@ BEGIN IDS_YES "&Yes" IDS_NO "&No" + IDS_SETTINGS "S&ettings..." IDS_RESTORELANGBAR "Restore Language Bar" IDS_LANGUAGE "Language" - IDS_RESTORELANGBAR2 "&Restore Language Bar" IDS_LANGUAGEBUTTON "Language Button" + IDS_TRANSPARENCY "&Transparency" + IDS_TEXTLABELS "Tex&t Labels" + IDS_MINIMIZE "&Minimize" + IDS_CLOSELANGBAR "&Close Language Bar" + IDS_EXTRAICONS "&Additional icons in taskbar" + IDS_RESTORELANGBAR2 "&Restore Language Bar" IDS_MENUWND "Menu Window" + IDS_VERTICAL "&Vertical" + IDS_ADJUSTLANGBAND "&Adjust Language Band position" IDS_LEFTCLICK "Left Click" END diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index ba2b71e43ca..899d51d5442 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -15,6 +15,7 @@ UINT g_uACP = CP_ACP; DWORD g_dwOSInfo = 0; CRITICAL_SECTION g_cs; LONG g_DllRefCount = 0; +BOOL g_bWinLogon = FALSE; BOOL g_bShowTipbar = TRUE; BOOL g_bShowDebugMenu = FALSE; @@ -307,6 +308,60 @@ HRESULT LangBarInsertSeparator(_In_ ITfMenu *pMenu) return pMenu->AddMenuItem(-1, TF_LBMENUF_SEPARATOR, NULL, NULL, NULL, 0, NULL); } +// Is it a Far-East language ID? +BOOL IsFELangId(LANGID LangID) +{ + switch (LangID) + { + case MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED): // Chinese (Simplified) + case MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL): // Chinese (Traditional) + case MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT): // Japanese + case MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT): // Korean + return TRUE; + default: + return FALSE; + } +} + +BOOL CheckCloseMenuAvailable(void) +{ + BOOL ret = FALSE; + ITfInputProcessorProfiles *pProfiles = NULL; + LANGID *pLangIds = NULL; + ULONG iItem, cItems; + + if (g_fPolicyDisableCloseButton) + return FALSE; + + if (g_bShowCloseMenu) + return TRUE; + + if (SUCCEEDED(TF_CreateInputProcessorProfiles(&pProfiles)) && + SUCCEEDED(pProfiles->GetLanguageList(&pLangIds, &cItems))) + { + for (iItem = 0; iItem < cItems; ++iItem) + { + if (IsFELangId(pLangIds[iItem])) + break; + } + + ret = (iItem == cItems); + } + + if (pLangIds) + CoTaskMemFree(pLangIds); + if (pProfiles) + pProfiles->Release(); + + return ret; +} + +/// @unimplemented +BOOL IsTransparecyAvailable(void) +{ + return FALSE; +} + BOOL InitFromReg(void) { DWORD dwValue; @@ -814,13 +869,38 @@ public: CModalMenu() { } virtual ~CModalMenu() { } - CUTBMenuItem *InsertItem(CUTBMenuWnd *pMenuUI, SIZE_T uBytes, INT nStringID); + CUTBMenuItem *InsertItem(CUTBMenuWnd *pMenuUI, INT nCommandId, INT nStringID); void PostKey(BOOL bUp, WPARAM wParam, LPARAM lParam); void CancelMenu(); }; /***********************************************************************/ +class CTipbarThread; + +class CUTBContextMenu : public CModalMenu +{ +public: + CTipbarWnd *m_pTipbarWnd; + CTipbarThread *m_pTipbarThread; + +public: + CUTBContextMenu(CTipbarWnd *pTipbarWnd); + + BOOL Init(); + CUTBMenuWnd *CreateMenuUI(BOOL bFlag); + + UINT ShowPopup( + CUIFWindow *pWindow, + POINT pt, + LPCRECT prc, + BOOL bFlag); + + BOOL SelectMenuItem(UINT nCommandId); +}; + +/***********************************************************************/ + class CUTBLBarMenuItem; class CUTBLBarMenu : public CCicLibMenu @@ -2173,7 +2253,7 @@ STDMETHODIMP_(INT) CUTBMenuItem::GetAccRole() */ CUTBMenuItem * -CModalMenu::InsertItem(CUTBMenuWnd *pMenuUI, SIZE_T uBytes, INT nStringID) +CModalMenu::InsertItem(CUTBMenuWnd *pMenuUI, INT nCommandId, INT nStringID) { CUTBMenuItem *pMenuItem = new(cicNoThrow) CUTBMenuItem(pMenuUI); if (!pMenuItem) @@ -2183,7 +2263,7 @@ CModalMenu::InsertItem(CUTBMenuWnd *pMenuUI, SIZE_T uBytes, INT nStringID) ::LoadStringW(g_hInst, nStringID, szText, _countof(szText)); if (pMenuItem->Initialize() && - pMenuItem->Init(uBytes, szText) && + pMenuItem->Init(nCommandId, szText) && pMenuUI->InsertItem(pMenuItem)) { return pMenuItem; @@ -2204,6 +2284,246 @@ void CModalMenu::CancelMenu() m_pMenuUI->CancelMenu(); } +/*********************************************************************** + * CUTBContextMenu + */ + +CUTBContextMenu::CUTBContextMenu(CTipbarWnd *pTipbarWnd) +{ + m_pTipbarWnd = pTipbarWnd; +} + +/// @unimplemented +BOOL CUTBContextMenu::Init() +{ +#if 0 // FIXME: m_pTipbarWnd + m_pTipbarThread = m_pTipbarWnd->m_pFocusThread; + return !!m_pTipbarThread; +#else + return TRUE; +#endif +} + +/// @unimplemented +CUTBMenuWnd *CUTBContextMenu::CreateMenuUI(BOOL bFlag) +{ + DWORD dwStatus = 0; + +#if 0 // FIXME: m_pTipbarWnd + if (FAILED(m_pTipbarWnd->m_pLangBarMgr->GetShowFloatingStatus(&dwStatus))) + return NULL; +#endif + + CUTBMenuWnd *pMenuUI = new (cicNoThrow) CUTBMenuWnd(g_hInst, g_dwMenuStyle, 0); + if (!pMenuUI) + return NULL; + + pMenuUI->Initialize(); + + if (dwStatus & (TF_SFT_DESKBAND | TF_SFT_MINIMIZED)) + { + CUTBMenuItem *pRestoreLangBar = InsertItem(pMenuUI, ID_RESTORELANGBAR, IDS_RESTORELANGBAR2); +#if 0 // FIXME: m_pTipbarWnd + if (pRestoreLangBar && !m_pTipbarWnd->m_dwUnknown20) + pRestoreLangBar->Gray(TRUE); +#endif + pRestoreLangBar = pRestoreLangBar; + } + else + { + InsertItem(pMenuUI, ID_DESKBAND, IDS_MINIMIZE); + + if (bFlag) + { + if (IsTransparecyAvailable()) + { + if (dwStatus & TF_LBI_BALLOON) + { + InsertItem(pMenuUI, ID_TRANS, IDS_TRANSPARENCY); + } + else + { + CUTBMenuItem *pTransparency = InsertItem(pMenuUI, ID_NOTRANS, IDS_TRANSPARENCY); + if (pTransparency) + pTransparency->Check(TRUE); + } + } + + if (!(dwStatus & TF_SFT_LABELS)) + { + InsertItem(pMenuUI, ID_LABELS, IDS_TEXTLABELS); + } + else + { + CUTBMenuItem *pTextLabels = InsertItem(pMenuUI, ID_NOLABELS, IDS_TEXTLABELS); + if (pTextLabels) + pTextLabels->Check(TRUE); + } + + CUTBMenuItem *pVertical = InsertItem(pMenuUI, ID_VERTICAL, IDS_VERTICAL); +#if 0 // FIXME: m_pTipbarWnd + if (pVertical) + pVertical->Check(!!(m_pTipbarWnd->m_dwTipbarWndFlags & 0x800000)); +#endif + pVertical = pVertical; + } + } + + if (bFlag) + { + CUTBMenuItem *pExtraIcons = NULL; + + if (dwStatus & TF_SFT_EXTRAICONSONMINIMIZED) + { + pExtraIcons = InsertItem(pMenuUI, ID_NOEXTRAICONS, IDS_EXTRAICONS); + if (pExtraIcons) + pExtraIcons->Check(TRUE); + } + else + { + pExtraIcons = CModalMenu::InsertItem(pMenuUI, ID_EXTRAICONS, IDS_EXTRAICONS); + } + + if (pExtraIcons) + { + if (::GetKeyboardLayoutList(0, NULL) == 1) + { + pExtraIcons->Check(TRUE); + pExtraIcons->Gray(TRUE); + } + else + { + pExtraIcons->Gray(FALSE); + } + } + + if (dwStatus & TF_SFT_DESKBAND) + InsertItem(pMenuUI, ID_ADJUSTDESKBAND, IDS_ADJUSTLANGBAND); + + InsertItem(pMenuUI, ID_SETTINGS, IDS_SETTINGS); + + if (CheckCloseMenuAvailable()) + InsertItem(pMenuUI, ID_CLOSELANGBAR, IDS_CLOSELANGBAR); + } + + return pMenuUI; +} + +UINT +CUTBContextMenu::ShowPopup( + CUIFWindow *pWindow, + POINT pt, + LPCRECT prc, + BOOL bFlag) +{ + if (g_bWinLogon) + return 0; + + if (m_pMenuUI) + return -1; + + m_pMenuUI = CreateMenuUI(bFlag); + if (!m_pMenuUI) + return 0; + + UINT nCommandId = m_pMenuUI->ShowModalPopup(pWindow, prc, TRUE); + + if (m_pMenuUI) + { + delete m_pMenuUI; + m_pMenuUI = NULL; + } + + return nCommandId; +} + +/// @unimplemented +BOOL CUTBContextMenu::SelectMenuItem(UINT nCommandId) +{ + switch (nCommandId) + { +#if 0 // FIXME: g_pTipbarWnd + case ID_TRANS: + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_LOWTRANSPARENCY); + break; + + case ID_NOTRANS: + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_NOTRANSPARENCY); + break; + + case ID_LABELS: + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_LABELS); + break; + + case ID_NOLABELS: + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_NOLABELS); + break; + + case ID_DESKBAND: + { + m_pTipbarWnd->m_pLangBarMgr->GetShowFloatingStatus(&dwStatus); + + if (dwStatus & TF_SFT_DESKBAND) + break; + + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_DESKBAND); + + CUTBMinimizeLangBarDlg *pDialog = new(cicNoThrow) CUTBMinimizeLangBarDlg(); + if (pDialog) + { + pDialog->DoModal(m_pTipbarWnd->m_Window); + pDialog->_Release(); + } + break; + } + + case ID_CLOSELANGBAR: + { + CUTBCloseLangBarDlg *pDialog = new(cicNoThrow) CUTBCloseLangBarDlg(); + if (pDialog) + { + BOOL bOK = pDialog->DoModal(m_pTipbarWnd->m_Window); + pDialog->_Release(); + if (!bOK) + DoCloseLangbar(); + } + break; + } + + case ID_EXTRAICONS: + m_pTipbarWnd->m_dwTipbarWndFlags &= ~0x4000; + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_EXTRAICONSONMINIMIZED); + break; + + case ID_NOEXTRAICONS: + m_pTipbarWnd->m_dwTipbarWndFlags &= ~0x4000; + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_NOEXTRAICONSONMINIMIZED); + break; + + case ID_RESTORELANGBAR: + m_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_LBI_ICON); + break; + + case ID_VERTICAL: + m_pTipbarWnd->SetVertical((m_pTipbarWnd->m_dwTipbarWndFlags & 0x4) ? TRUE : FALSE); + break; + + case ID_ADJUSTDESKBAND: + m_pTipbarWnd->AdjustDeskBandSize(TRUE); + break; +#endif + + case ID_SETTINGS: + TF_RunInputCPL(); + break; + + default: + break; + } + + return TRUE; +} + /*********************************************************************** * CTrayIconItem */ diff --git a/dll/win32/msutb/resource.h b/dll/win32/msutb/resource.h index ee02ba159b2..4a911d35967 100644 --- a/dll/win32/msutb/resource.h +++ b/dll/win32/msutb/resource.h @@ -10,13 +10,34 @@ #define IDI_MAINICON 100 +#define IDS_SETTINGS 300 #define IDS_RESTORELANGBAR 308 #define IDS_LANGUAGE 309 #define IDS_LANGUAGEBUTTON 310 +#define IDS_TRANSPARENCY 312 +#define IDS_TEXTLABELS 313 +#define IDS_MINIMIZE 314 +#define IDS_CLOSELANGBAR 315 +#define IDS_EXTRAICONS 318 #define IDS_RESTORELANGBAR2 321 #define IDS_MENUWND 322 +#define IDS_VERTICAL 324 +#define IDS_ADJUSTLANGBAND 326 #define IDS_LEFTCLICK 323 +#define ID_TRANS 208 +#define ID_NOTRANS 209 +#define ID_LABELS 210 +#define ID_NOLABELS 211 +#define ID_DESKBAND 212 +#define ID_CLOSELANGBAR 213 +#define ID_EXTRAICONS 214 +#define ID_NOEXTRAICONS 215 +#define ID_RESTORELANGBAR 216 +#define ID_VERTICAL 217 +#define ID_ADJUSTDESKBAND 219 +#define ID_SETTINGS 2000 + #define IDD_CLOSELANGBAR 1001 #define IDD_MINIMIZELANGBAR 1004 diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index f9f6e6fe17d..5ff4b4b090c 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -59,14 +59,15 @@ cpp_quote("EXTERN_C HANDLE WINAPI TF_CreateCicLoadMutex(_Out_ LPBOOL pfWinLogon cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCache(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_DllDetachInOther(VOID);") -cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateCategoryMgr(ITfCategoryMgr **ppcat);") -cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateDisplayAttributeMgr(ITfDisplayAttributeMgr **ppdam);") -cpp_quote("EXTERN_C HICON WINAPI TF_GetLangIcon(LANGID LangID, LPWSTR pszText, INT cchText);") +cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateCategoryMgr(_Out_ ITfCategoryMgr **ppcat);") +cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateDisplayAttributeMgr(_Out_ ITfDisplayAttributeMgr **ppdam);") +cpp_quote("EXTERN_C HICON WINAPI TF_GetLangIcon(_In_ LANGID LangID, _Out_ LPWSTR pszText, _In_ INT cchText);") cpp_quote("EXTERN_C HRESULT WINAPI TF_InitMlngInfo(VOID);") cpp_quote("EXTERN_C INT WINAPI TF_MlngInfoCount(VOID);") -cpp_quote("EXTERN_C BOOL WINAPI TF_GetMlngHKL(INT iKL, HKL *phKL, LPWSTR pszText, INT cchText);") -cpp_quote("EXTERN_C INT WINAPI TF_GetMlngIconIndex(INT iKL);") -cpp_quote("EXTERN_C HICON WINAPI TF_InatExtractIcon(INT iKL);") +cpp_quote("EXTERN_C BOOL WINAPI TF_GetMlngHKL(_In_ INT iKL, _Out_ HKL *phKL, _Out_ LPWSTR pszText, _In_ INT cchText);") +cpp_quote("EXTERN_C INT WINAPI TF_GetMlngIconIndex(_In_ INT iKL);") +cpp_quote("EXTERN_C HICON WINAPI TF_InatExtractIcon(_In_ INT iKL);") +cpp_quote("EXTERN_C HRESULT WINAPI TF_RunInputCPL(VOID);") cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;") cpp_quote("EXTERN_C const GUID GUID_PROP_ATTRIBUTE;")
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSUTB][SDK] Add CModalMenu (#6451)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c9c5b3d3ae4e849f81d3f…
commit c9c5b3d3ae4e849f81d3f0cdab72a2134cb62853 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Feb 7 14:11:21 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Feb 7 14:11:21 2024 +0900 [MSUTB][SDK] Add CModalMenu (#6451) Supporting Language Bar... JIRA issue: CORE-19363 - Fix the return value type of CUIFObject::Initialize method. - Implement CModalMenu class. --- dll/win32/msutb/msutb.cpp | 77 +++++++++++++++++++++++++++++++------ sdk/include/reactos/cicero/cicuif.h | 18 +++++---- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 37b5176bb1e..ba2b71e43ca 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -769,7 +769,7 @@ public: STDMETHOD_(BSTR, GetAccName)() override; STDMETHOD_(INT, GetAccRole)() override; - STDMETHOD_(void, Initialize)() override; + STDMETHOD_(BOOL, Initialize)() override; STDMETHOD_(void, OnCreate)(HWND hWnd) override; STDMETHOD_(void, OnDestroy)(HWND hWnd) override; STDMETHOD_(HRESULT, OnGetObject)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override; @@ -782,11 +782,11 @@ public: class CUTBMenuItem : public CTipbarAccItem, public CUIFMenuItem { protected: - CUTBMenuWnd *m_pMenuWnd; + CUTBMenuWnd *m_pMenuUI; friend class CUTBMenuWnd; public: - CUTBMenuItem(CUTBMenuWnd *pMenuWnd); + CUTBMenuItem(CUTBMenuWnd *pMenuUI); ~CUTBMenuItem() override; CUIFMenuItem* GetMenuItem() @@ -804,6 +804,23 @@ public: /***********************************************************************/ +class CModalMenu +{ +public: + DWORD m_dwUnknown26; + CUTBMenuWnd *m_pMenuUI; + +public: + CModalMenu() { } + virtual ~CModalMenu() { } + + CUTBMenuItem *InsertItem(CUTBMenuWnd *pMenuUI, SIZE_T uBytes, INT nStringID); + void PostKey(BOOL bUp, WPARAM wParam, LPARAM lParam); + void CancelMenu(); +}; + +/***********************************************************************/ + class CUTBLBarMenuItem; class CUTBLBarMenu : public CCicLibMenu @@ -1994,7 +2011,7 @@ STDMETHODIMP_(INT) CUTBMenuWnd::GetAccRole() return 9; } -STDMETHODIMP_(void) CUTBMenuWnd::Initialize() +STDMETHODIMP_(BOOL) CUTBMenuWnd::Initialize() { CTipbarAccessible *pAccessible = new(cicNoThrow) CTipbarAccessible(GetAccItem()); if (pAccessible) @@ -2086,10 +2103,10 @@ STDMETHODIMP_(void) CUTBMenuWnd::OnTimer(WPARAM wParam) * CUTBMenuItem */ -CUTBMenuItem::CUTBMenuItem(CUTBMenuWnd *pMenuWnd) - : CUIFMenuItem(pMenuWnd ? pMenuWnd->GetMenu() : NULL) +CUTBMenuItem::CUTBMenuItem(CUTBMenuWnd *pMenuUI) + : CUIFMenuItem(pMenuUI ? pMenuUI->GetMenu() : NULL) { - m_pMenuWnd = pMenuWnd; + m_pMenuUI = pMenuUI; } CUTBMenuItem::~CUTBMenuItem() @@ -2108,10 +2125,10 @@ CUTBMenuItem::~CUTBMenuItem() STDMETHODIMP_(BOOL) CUTBMenuItem::DoAccDefaultAction() { - if (!m_pMenuWnd) + if (!m_pMenuUI) return FALSE; - m_pMenuWnd->StartDoAccDefaultActionTimer(this); + m_pMenuUI->StartDoAccDefaultActionTimer(this); return TRUE; } @@ -2134,8 +2151,8 @@ STDMETHODIMP_(BSTR) CUTBMenuItem::GetAccDefaultAction() STDMETHODIMP_(void) CUTBMenuItem::GetAccLocation(LPRECT lprc) { GetRect(lprc); - ::ClientToScreen(m_pMenuWnd->m_hWnd, (LPPOINT)lprc); - ::ClientToScreen(m_pMenuWnd->m_hWnd, (LPPOINT)&lprc->right); + ::ClientToScreen(m_pMenuUI->m_hWnd, (LPPOINT)lprc); + ::ClientToScreen(m_pMenuUI->m_hWnd, (LPPOINT)&lprc->right); } STDMETHODIMP_(BSTR) CUTBMenuItem::GetAccName() @@ -2151,6 +2168,42 @@ STDMETHODIMP_(INT) CUTBMenuItem::GetAccRole() return 12; } +/*********************************************************************** + * CModalMenu + */ + +CUTBMenuItem * +CModalMenu::InsertItem(CUTBMenuWnd *pMenuUI, SIZE_T uBytes, INT nStringID) +{ + CUTBMenuItem *pMenuItem = new(cicNoThrow) CUTBMenuItem(pMenuUI); + if (!pMenuItem) + return NULL; + + WCHAR szText[256]; + ::LoadStringW(g_hInst, nStringID, szText, _countof(szText)); + + if (pMenuItem->Initialize() && + pMenuItem->Init(uBytes, szText) && + pMenuUI->InsertItem(pMenuItem)) + { + return pMenuItem; + } + + delete pMenuItem; + return NULL; +} + +void CModalMenu::PostKey(BOOL bUp, WPARAM wParam, LPARAM lParam) +{ + m_pMenuUI->PostKey(bUp, wParam, lParam); +} + +void CModalMenu::CancelMenu() +{ + if (m_pMenuUI) + m_pMenuUI->CancelMenu(); +} + /*********************************************************************** * CTrayIconItem */ @@ -2976,7 +3029,7 @@ STDMETHODIMP CLBarInatItem::OnMenuSelect(INT nCommandId) #if 0 // FIXME: g_pTipbarWnd g_pTipbarWnd->RestoreLastFocus(0, (g_pTipbarWnd->m_dwTipbarWndFlags & 2) != 0); #endif - HWND hwndFore = GetForegroundWindow(); + HWND hwndFore = ::GetForegroundWindow(); if (m_dwThreadId == ::GetWindowThreadProcessId(hwndFore, NULL)) { BOOL FontSig = GetFontSig(hwndFore, hKL); diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 996f48230c6..ba9e9d8ab42 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -236,7 +236,7 @@ public: void StartTimer(WPARAM wParam); void EndTimer(); - STDMETHOD_(void, Initialize)() { } + STDMETHOD_(BOOL, Initialize)() { return TRUE; } STDMETHOD_(void, OnPaint)(HDC hDC); STDMETHOD_(void, OnTimer)() { } STDMETHOD_(void, OnLButtonDown)(LONG x, LONG y) { } @@ -568,7 +568,7 @@ public: static CUIFWindow* GetThis(HWND hWnd); static void SetThis(HWND hWnd, LONG_PTR dwNewLong); - STDMETHOD_(void, Initialize)() override; + STDMETHOD_(BOOL, Initialize)() override; STDMETHOD_(void, Show)(BOOL bVisible) override; STDMETHOD_(void, SetRect)(LPCRECT prc) override; STDMETHOD_(void, PaintObject)(HDC hDC, LPCRECT prc) override; @@ -697,7 +697,7 @@ public: void AdjustWindowPos(); void OnOwnerWndMoved(BOOL bDoSize); - STDMETHOD_(void, Initialize)() override; + STDMETHOD_(BOOL, Initialize)() override; STDMETHOD_(DWORD, GetWndStyleEx)() override; STDMETHOD_(void, OnPaint)(HDC hDC) override; STDMETHOD_(LRESULT, OnWindowPosChanging)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) override; @@ -1064,7 +1064,7 @@ public: CUIFBalloonWindow(HINSTANCE hInst, DWORD style); ~CUIFBalloonWindow() override; - STDMETHOD_(void, Initialize)() override; + STDMETHOD_(BOOL, Initialize)() override; STDMETHOD_(LPCTSTR, GetClassName)() override { return TEXT("MSIME_PopupMessage"); } STDMETHOD_(LPCTSTR, GetWndTitle)() override { return TEXT("MSIME_PopupMessage"); } STDMETHOD_(void, OnCreate)(HWND hWnd) override; @@ -2561,7 +2561,7 @@ inline CUIFWindow::~CUIFWindow() } } -inline STDMETHODIMP_(void) +inline STDMETHODIMP_(BOOL) CUIFWindow::Initialize() { LPCTSTR pszClass = GetClassName(); @@ -3366,11 +3366,11 @@ inline void CUIFShadow::OnOwnerWndMoved(BOOL bDoSize) } } -inline STDMETHODIMP_(void) +inline STDMETHODIMP_(BOOL) CUIFShadow::Initialize() { InitSettings(); - CUIFWindow::Initialize(); + return CUIFWindow::Initialize(); } inline STDMETHODIMP_(DWORD) @@ -5060,7 +5060,7 @@ CUIFBalloonWindow::~CUIFBalloonWindow() } } -inline STDMETHODIMP_(void) +inline STDMETHODIMP_(BOOL) CUIFBalloonWindow::Initialize() { CUIFWindow::Initialize(); @@ -5074,6 +5074,8 @@ CUIFBalloonWindow::Initialize() AddButton(IDYES); AddButton(IDNO); } + + return TRUE; } inline STDMETHODIMP_(void)
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSI] Don't write past end of string when selecting parent directory (#6335)
by Doug Lyons
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2bc44bf95c0d967a2b2fd…
commit 2bc44bf95c0d967a2b2fd5a5c8e5bdfe2228b5b4 Author: Doug Lyons <douglyons(a)douglyons.com> AuthorDate: Tue Feb 6 14:20:57 2024 -0600 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Feb 6 23:20:57 2024 +0300 [MSI] Don't write past end of string when selecting parent directory (#6335) Import Wine commit:
https://github.com/wine-mirror/wine/commit/bbce5d014db7f023b133d6d09e6846e0…
Since there's not really something sensible to do in the "path contains no backslashes" case (adding a backslash seems pointless), move PathAddBackslashW call inside the if condition to avoid the crash. Fix suggested by Thomas Faber. This fixes heap assert in msi/dialog.c when installing Tortoise GIT. CORE-16693 Co-authored-by: Thomas Faber <thomas.faber(a)reactos.org> Co-authored-by: Fabian Maurer <dark.shadow4(a)web.de> --- dll/win32/msi/dialog.c | 7 +++++-- media/doc/WINESYNC.txt | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index 7050d353bb7..97257636e5e 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -2943,8 +2943,11 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) /* strip off the last directory */ ptr = PathFindFileNameW( path ); - if (ptr != path) *(ptr - 1) = '\0'; - PathAddBackslashW( path ); + if (ptr != path) + { + *(ptr - 1) = '\0'; + PathAddBackslashW( path ); + } msi_dialog_set_property( dialog->package, prop, path ); diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index f6614ac83a9..6528ad4e6c5 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -115,7 +115,7 @@ dll/win32/msg711.acm # Synced to WineStaging-4.18 dll/win32/msgsm32.acm # Synced to WineStaging-4.0 dll/win32/mshtml # Synced to WineStaging-1.7.55 dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55 -dll/win32/msi # Synced to WineStaging-7.3 +dll/win32/msi # Synced to WineStaging-7.3 (+ dialog.c synced to bbce5d014db7f023b133d6d09e6846e027586f7d) dll/win32/msimg32 # Synced to WineStaging-3.3 dll/win32/msimtf # Synced to WineStaging-4.18 dll/win32/msisip # Synced to WineStaging-4.18
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSCTF][MSUTB][SDK] Add CLBarInatItem (#6447)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0bce79a50b52bce96b54a…
commit 0bce79a50b52bce96b54ab334bb0bf7fe742feb8 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Feb 6 21:39:32 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Feb 6 21:39:32 2024 +0900 [MSCTF][MSUTB][SDK] Add CLBarInatItem (#6447) Supporting Language Bar... JIRA issue: CORE-19363 - Modify msctf.spec. - Add some helper functions. - Half-implement CLBarInatItem class. - Add some TF_... function prototypes to "msctf.idl". --- dll/win32/msctf/msctf.spec | 8 +- dll/win32/msutb/lang/en-US.rc | 3 + dll/win32/msutb/msutb.cpp | 208 ++++++++++++++++++++++++++++++++++++ dll/win32/msutb/resource.h | 3 + sdk/include/psdk/msctf.idl | 5 + sdk/include/reactos/cicero/cicutb.h | 1 + 6 files changed, 224 insertions(+), 4 deletions(-) diff --git a/dll/win32/msctf/msctf.spec b/dll/win32/msctf/msctf.spec index 52288129e1c..975acdb2118 100644 --- a/dll/win32/msctf/msctf.spec +++ b/dll/win32/msctf/msctf.spec @@ -19,11 +19,11 @@ @ stdcall -stub TF_GetGlobalCompartment(ptr) @ stub TF_GetInputScope @ stdcall -stub TF_GetLangIcon(long ptr long) -@ stub TF_GetMlngHKL -@ stub TF_GetMlngIconIndex +@ stdcall -stub TF_GetMlngHKL(long ptr ptr long) +@ stdcall -stub TF_GetMlngIconIndex(long) @ stub TF_GetThreadFlags @ stdcall TF_GetThreadMgr(ptr) -@ stub TF_InatExtractIcon +@ stdcall -stub TF_InatExtractIcon(long) @ stdcall TF_InitMlngInfo() @ stdcall -stub TF_InitSystem() @ stdcall -stub TF_UninitSystem() @@ -31,7 +31,7 @@ @ stdcall TF_InvalidAssemblyListCacheIfExist() @ stdcall TF_IsCtfmonRunning() @ stub TF_IsInMarshaling -@ stub TF_MlngInfoCount +@ stdcall -stub TF_MlngInfoCount() @ stdcall TF_RunInputCPL() @ stdcall -stub TF_PostAllThreadMsg(long long) @ stdcall TF_RegisterLangBarAddIn(ptr wstr long) diff --git a/dll/win32/msutb/lang/en-US.rc b/dll/win32/msutb/lang/en-US.rc index 3c3a7a579dd..8b09fb014c3 100644 --- a/dll/win32/msutb/lang/en-US.rc +++ b/dll/win32/msutb/lang/en-US.rc @@ -18,6 +18,9 @@ BEGIN IDS_NO "&No" IDS_RESTORELANGBAR "Restore Language Bar" + IDS_LANGUAGE "Language" + IDS_RESTORELANGBAR2 "&Restore Language Bar" + IDS_LANGUAGEBUTTON "Language Button" IDS_MENUWND "Menu Window" IDS_LEFTCLICK "Left Click" END diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 21a68f70b54..37b5176bb1e 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -111,6 +111,22 @@ BOOL IsBiDiLocalizedSystem(void) return (Sig.lsUsb[3] & 0x8000000) != 0; } +BOOL GetFontSig(HWND hWnd, HKL hKL) +{ + LOCALESIGNATURE Sig; + INT size = sizeof(Sig) / sizeof(WCHAR); + if (!::GetLocaleInfoW(LOWORD(hKL), LOCALE_FONTSIGNATURE, (LPWSTR)&Sig, size)) + return FALSE; + + HDC hDC = ::GetDC(hWnd); + DWORD CharSet = ::GetTextCharsetInfo(hDC, NULL, 0); + CHARSETINFO CharSetInfo; + ::TranslateCharsetInfo((DWORD*)(DWORD_PTR)CharSet, &CharSetInfo, TCI_SRCCHARSET); + ::ReleaseDC(hWnd, hDC); + + return !!(CharSetInfo.fs.fsCsb[0] & Sig.lsCsbSupported[0]); +} + void InitSkipRedrawHKLArray(void) { g_prghklSkipRedrawing = new(cicNoThrow) CicArray<HKL>(); @@ -228,6 +244,69 @@ void DoCloseLangbar(void) ::RegDeleteValue(regKey, TEXT("ctfmon.exe")); } +INT GetIconIndexFromhKL(_In_ HKL hKL) +{ + HKL hGotKL; + + INT iKL, cKLs = TF_MlngInfoCount(); + for (iKL = 0; iKL < cKLs; ++iKL) + { + if (TF_GetMlngHKL(iKL, &hGotKL, NULL, 0) && hKL == hGotKL) + return TF_GetMlngIconIndex(iKL); + } + + if (!TF_GetMlngHKL(0, &hGotKL, NULL, 0)) + return -1; + + return TF_GetMlngIconIndex(0); +} + +BOOL GethKLDesc(_In_ HKL hKL, _Out_ LPWSTR pszDesc, _In_ UINT cchDesc) +{ + HKL hGotKL; + + INT iKL, cKLs = TF_MlngInfoCount(); + for (iKL = 0; iKL < cKLs; ++iKL) + { + if (TF_GetMlngHKL(iKL, &hGotKL, pszDesc, cchDesc) && hKL == hGotKL) + return TRUE; + } + + return TF_GetMlngHKL(0, &hGotKL, pszDesc, cchDesc); +} + +HRESULT +LangBarInsertMenu( + _In_ ITfMenu *pMenu, + _In_ UINT uId, + _In_ LPCWSTR pszText, + _In_ BOOL bChecked, + _Inout_opt_ HICON hIcon) +{ + HBITMAP hbmp = NULL, hbmpMask = NULL; + if (hIcon) + { + HICON hIconNew = (HICON)::CopyImage(hIcon, IMAGE_ICON, 16, 16, LR_COPYFROMRESOURCE); + SIZE iconSize = { 16, 16 }; + if (!hIconNew) + hIconNew = hIcon; + if (!cicGetIconBitmaps(hIconNew, &hbmp, &hbmpMask, &iconSize)) + return E_FAIL; + if (hIconNew) + ::DestroyIcon(hIconNew); + ::DestroyIcon(hIcon); + } + + INT cchText = lstrlenW(pszText); + DWORD dwFlags = (bChecked ? TF_LBMENUF_CHECKED : 0); + return pMenu->AddMenuItem(uId, dwFlags, hbmp, hbmpMask, pszText, cchText, NULL); +} + +HRESULT LangBarInsertSeparator(_In_ ITfMenu *pMenu) +{ + return pMenu->AddMenuItem(-1, TF_LBMENUF_SEPARATOR, NULL, NULL, NULL, 0, NULL); +} + BOOL InitFromReg(void) { DWORD dwValue; @@ -934,6 +1013,24 @@ public: STDMETHOD(UnadviseSink)(DWORD dwCookie) override; }; +/***********************************************************************/ + +/// Language Bar international item +class CLBarInatItem : public CLBarItemButtonBase +{ +protected: + HKL m_hKL; + DWORD m_dwThreadId; + +public: + CLBarInatItem(DWORD dwThreadId); + + STDMETHOD(InitMenu)(ITfMenu *pMenu) override; + STDMETHOD(OnMenuSelect)(INT nCommandId); + STDMETHOD(GetIcon)(HICON *phIcon) override; + STDMETHOD(GetText)(BSTR *pbstr) override; +}; + /*********************************************************************** * CUTBLangBarDlg */ @@ -2779,6 +2876,117 @@ STDMETHODIMP CLBarItemButtonBase::UnadviseSink(DWORD dwCookie) return CLBarItemBase::UnadviseSink(dwCookie); } +/*********************************************************************** + * CLBarInatItem + */ + +CLBarInatItem::CLBarInatItem(DWORD dwThreadId) +{ + WCHAR szText[256]; + ::LoadStringW(g_hInst, IDS_LANGUAGE, szText, _countof(szText)); + InitNuiInfo(CLSID_SYSTEMLANGBARITEM, GUID_LBI_INATITEM, 0x20001, 0, szText); + + ::LoadStringW(g_hInst, IDS_LANGUAGEBUTTON, szText, _countof(szText)); + StringCchCopyW(m_szToolTipText, _countof(m_szToolTipText), szText); + m_dwThreadId = dwThreadId; + m_hKL = ::GetKeyboardLayout(m_dwThreadId); + + TF_InitMlngInfo(); + ShowInternal(TF_MlngInfoCount() > 1, 0); +} + +STDMETHODIMP CLBarInatItem::GetIcon(HICON *phIcon) +{ + HICON hIcon = NULL; + INT iIndex = GetIconIndexFromhKL(m_hKL); + if (iIndex != -1) + hIcon = TF_InatExtractIcon(iIndex); + *phIcon = hIcon; + return S_OK; +} + +STDMETHODIMP CLBarInatItem::GetText(BSTR *pbstr) +{ + if (!pbstr) + return E_INVALIDARG; + + WCHAR szText[256]; + if (!GethKLDesc(m_hKL, szText, _countof(szText))) + return GetText(pbstr); + + *pbstr = ::SysAllocString(szText); + return S_OK; +} + +STDMETHODIMP CLBarInatItem::InitMenu(ITfMenu *pMenu) +{ + TF_InitMlngInfo(); + + INT iKL, cKLs = TF_MlngInfoCount(); + for (iKL = 0; iKL < cKLs; ++iKL) + { + HKL hKL; + WCHAR szDesc[128]; + if (TF_GetMlngHKL(iKL, &hKL, szDesc, _countof(szDesc))) + { + HICON hIcon = NULL; + INT iIndex = GetIconIndexFromhKL(hKL); + if (iIndex != -1) + hIcon = TF_InatExtractIcon(iIndex); + + LangBarInsertMenu(pMenu, iKL, szDesc, (hKL == m_hKL), hIcon); + } + } + +#if 0 // FIXME: g_pTipbarWnd + DWORD dwStatus; + if (g_pTipbarWnd && + g_pTipbarWnd->m_pLangBarMgr && + SUCCEEDED(g_pTipbarWnd->m_pLangBarMgr->GetShowFloatingStatus(&dwStatus)) && + (dwStatus & (TF_SFT_DESKBAND | TF_SFT_MINIMIZED))) + { + LangBarInsertSeparator(pMenu); + + WCHAR szText[256]; + ::LoadStringW(g_hInst, IDS_RESTORELANGBAR2, szText, _countof(szText)); + LangBarInsertMenu(pMenu, 2000, szText, FALSE, NULL); + } +#endif + + return S_OK; +} + +STDMETHODIMP CLBarInatItem::OnMenuSelect(INT nCommandId) +{ + HKL hKL; + + if (nCommandId == 2000) + { + if (g_pTipbarWnd) + { +#if 0 // FIXME: g_pTipbarWnd + ITfLangBarMgr *pLangBarMgr = g_pTipbarWnd->m_pLangBarMgr; + if (pLangBarMgr) + pLangBarMgr->ShowFloating(TF_SFT_SHOWNORMAL); +#endif + } + } + else if (TF_GetMlngHKL(nCommandId, &hKL, NULL, 0)) + { +#if 0 // FIXME: g_pTipbarWnd + g_pTipbarWnd->RestoreLastFocus(0, (g_pTipbarWnd->m_dwTipbarWndFlags & 2) != 0); +#endif + HWND hwndFore = GetForegroundWindow(); + if (m_dwThreadId == ::GetWindowThreadProcessId(hwndFore, NULL)) + { + BOOL FontSig = GetFontSig(hwndFore, hKL); + ::PostMessage(hwndFore, WM_INPUTLANGCHANGEREQUEST, FontSig, (LPARAM)hKL); + } + } + + return S_OK; +} + /*********************************************************************** * GetLibTls (MSUTB.@) * diff --git a/dll/win32/msutb/resource.h b/dll/win32/msutb/resource.h index c3abc6b696c..ee02ba159b2 100644 --- a/dll/win32/msutb/resource.h +++ b/dll/win32/msutb/resource.h @@ -11,6 +11,9 @@ #define IDI_MAINICON 100 #define IDS_RESTORELANGBAR 308 +#define IDS_LANGUAGE 309 +#define IDS_LANGUAGEBUTTON 310 +#define IDS_RESTORELANGBAR2 321 #define IDS_MENUWND 322 #define IDS_LEFTCLICK 323 diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index 748787fb795..f9f6e6fe17d 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -62,6 +62,11 @@ cpp_quote("EXTERN_C HRESULT WINAPI TF_DllDetachInOther(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateCategoryMgr(ITfCategoryMgr **ppcat);") cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateDisplayAttributeMgr(ITfDisplayAttributeMgr **ppdam);") cpp_quote("EXTERN_C HICON WINAPI TF_GetLangIcon(LANGID LangID, LPWSTR pszText, INT cchText);") +cpp_quote("EXTERN_C HRESULT WINAPI TF_InitMlngInfo(VOID);") +cpp_quote("EXTERN_C INT WINAPI TF_MlngInfoCount(VOID);") +cpp_quote("EXTERN_C BOOL WINAPI TF_GetMlngHKL(INT iKL, HKL *phKL, LPWSTR pszText, INT cchText);") +cpp_quote("EXTERN_C INT WINAPI TF_GetMlngIconIndex(INT iKL);") +cpp_quote("EXTERN_C HICON WINAPI TF_InatExtractIcon(INT iKL);") cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;") cpp_quote("EXTERN_C const GUID GUID_PROP_ATTRIBUTE;") diff --git a/sdk/include/reactos/cicero/cicutb.h b/sdk/include/reactos/cicero/cicutb.h index 916b0c4befb..6df17b7c0f2 100644 --- a/sdk/include/reactos/cicero/cicutb.h +++ b/sdk/include/reactos/cicero/cicutb.h @@ -12,6 +12,7 @@ DEFINE_GUID(GUID_LBI_TRAYMAIN, 0xE0B724E9, 0x6F76, 0x45F7, 0xB4, DEFINE_GUID(GUID_LBI_INATITEM, 0xCDBC683A, 0x55CE, 0x4717, 0xBA, 0xC0, 0x50, 0xBF, 0x44, 0xA3, 0x27, 0x0C); DEFINE_GUID(GUID_LBI_CTRL, 0x58C99D96, 0x2F9B, 0x42CE, 0x91, 0xBE, 0x37, 0xEF, 0x18, 0x60, 0xF8, 0x82); DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745C63, 0xB2F0, 0x4784, 0x8B, 0x67, 0x5E, 0x12, 0xC8, 0x70, 0x1A, 0x31); +DEFINE_GUID(CLSID_SYSTEMLANGBARITEM, 0xBEBACC94, 0x5CD3, 0x4662, 0xA1, 0xE0, 0xF3, 0x31, 0x99, 0x49, 0x36, 0x69); EXTERN_C LPVOID WINAPI GetLibTls(VOID); EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon);
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSUTB] Add CLBarItemButtonBase (#6446)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8bf0854c8e7b5b4e0845f…
commit 8bf0854c8e7b5b4e0845f204356f878a3fb684d0 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Feb 6 15:58:16 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Feb 6 15:58:16 2024 +0900 [MSUTB] Add CLBarItemButtonBase (#6446) Supporting Language Bar... JIRA issue: CORE-19363 - Implement CLBarItemButtonBase class. - Improve CLBarItemBase class. --- dll/win32/msutb/msutb.cpp | 174 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 167 insertions(+), 7 deletions(-) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 4d988b4f26b..21a68f70b54 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -865,7 +865,7 @@ public: /***********************************************************************/ -class CLBarItemBase : public ITfLangBarItem +class CLBarItemBase { protected: DWORD m_dwItemStatus; @@ -887,14 +887,51 @@ public: DWORD ulSort, LPCWSTR Source); + HRESULT GetInfo(TF_LANGBARITEMINFO *pInfo); + HRESULT GetStatus(DWORD *pdwStatus); + HRESULT Show(BOOL fShow); + HRESULT GetTooltipString(BSTR *pbstrToolTip); + HRESULT AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie); HRESULT UnadviseSink(DWORD dwCookie); +}; + +/***********************************************************************/ + +class CLBarItemButtonBase + : public CLBarItemBase + , public ITfLangBarItem + , public ITfLangBarItemButton + , public ITfSource +{ +public: + HICON m_hIcon; + +public: + CLBarItemButtonBase() { m_hIcon = NULL; } + ~CLBarItemButtonBase() override; + + // IUnknown methods + STDMETHOD(QueryInterface)(REFIID riid, void **ppvObject) override; + STDMETHOD_(ULONG, AddRef)() override; + STDMETHOD_(ULONG, Release)() override; // ITfLangBarItem methods STDMETHOD(GetInfo)(TF_LANGBARITEMINFO *pInfo) override; STDMETHOD(GetStatus)(DWORD *pdwStatus) override; STDMETHOD(Show)(BOOL fShow) override; STDMETHOD(GetTooltipString)(BSTR *pbstrToolTip) override; + + // ITfLangBarItemButton methods + STDMETHOD(OnClick)(TfLBIClick click, POINT pt, LPCRECT prc) override; + STDMETHOD(InitMenu)(ITfMenu *pMenu) override; + STDMETHOD(OnMenuSelect)(UINT wID) override; + STDMETHOD(GetIcon)(HICON *phIcon) override; + STDMETHOD(GetText)(BSTR *pbstr) override; + + // ITfSource methods + STDMETHOD(AdviseSink)(REFIID riid, IUnknown *punk, DWORD *pdwCookie) override; + STDMETHOD(UnadviseSink)(DWORD dwCookie) override; }; /*********************************************************************** @@ -2494,10 +2531,12 @@ HRESULT CLBarItemBase::ShowInternal(BOOL bShow, BOOL bUpdate) { DWORD dwOldStatus = m_dwItemStatus; + if (bShow) - m_dwItemStatus &= ~0x1; + m_dwItemStatus &= ~TF_LBI_STATUS_HIDDEN; else - m_dwItemStatus |= 0x1; + m_dwItemStatus |= TF_LBI_STATUS_HIDDEN; + if (bUpdate && (dwOldStatus != m_dwItemStatus)) { if (m_pLangBarItemSink) @@ -2507,24 +2546,24 @@ CLBarItemBase::ShowInternal(BOOL bShow, BOOL bUpdate) return S_OK; } -STDMETHODIMP CLBarItemBase::GetInfo(TF_LANGBARITEMINFO *pInfo) +HRESULT CLBarItemBase::GetInfo(TF_LANGBARITEMINFO *pInfo) { CopyMemory(pInfo, &m_NewUIInfo, sizeof(*pInfo)); return S_OK; } -STDMETHODIMP CLBarItemBase::GetStatus(DWORD *pdwStatus) +HRESULT CLBarItemBase::GetStatus(DWORD *pdwStatus) { *pdwStatus = m_dwItemStatus; return S_OK; } -STDMETHODIMP CLBarItemBase::Show(BOOL fShow) +HRESULT CLBarItemBase::Show(BOOL fShow) { return ShowInternal(fShow, TRUE); } -STDMETHODIMP CLBarItemBase::GetTooltipString(BSTR *pbstrToolTip) +HRESULT CLBarItemBase::GetTooltipString(BSTR *pbstrToolTip) { if (!pbstrToolTip) return E_INVALIDARG; @@ -2619,6 +2658,127 @@ BOOL CUTBLBarMenuItem::InsertToUI(CUTBMenuWnd *pMenuUI) return FALSE; } +/*********************************************************************** + * CLBarItemButtonBase + */ + +CLBarItemButtonBase::~CLBarItemButtonBase() +{ + if (m_hIcon) + { + ::DestroyIcon(m_hIcon); + m_hIcon = NULL; + } +} + +STDMETHODIMP CLBarItemButtonBase::QueryInterface(REFIID riid, void **ppvObject) +{ + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfLangBarItem)) + { + *ppvObject = static_cast<ITfLangBarItem*>(this); + AddRef(); + return S_OK; + } + if (IsEqualIID(riid, IID_ITfLangBarItemButton)) + { + *ppvObject = static_cast<ITfLangBarItemButton*>(this); + AddRef(); + return S_OK; + } + if (IsEqualIID(riid, IID_ITfSource)) + { + *ppvObject = static_cast<ITfSource*>(this); + AddRef(); + return S_OK; + } + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) CLBarItemButtonBase::AddRef() +{ + return ++m_cRefs; +} + +STDMETHODIMP_(ULONG) CLBarItemButtonBase::Release() +{ + if (--m_cRefs == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +/// @unimplemented +STDMETHODIMP CLBarItemButtonBase::OnClick(TfLBIClick click, POINT pt, LPCRECT prc) +{ + if (click == TF_LBI_CLK_RIGHT) + { + return E_NOTIMPL; //FIXME + } + if (click == TF_LBI_CLK_LEFT) + { + return E_NOTIMPL; //FIXME + } + return E_NOTIMPL; +} + +STDMETHODIMP CLBarItemButtonBase::InitMenu(ITfMenu *pMenu) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CLBarItemButtonBase::OnMenuSelect(UINT wID) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CLBarItemButtonBase::GetIcon(HICON *phIcon) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CLBarItemButtonBase::GetText(BSTR *pbstr) +{ + if (!pbstr) + return E_INVALIDARG; + *pbstr = ::SysAllocString(m_NewUIInfo.szDescription); + return (*pbstr ? S_OK : E_OUTOFMEMORY); +} + +STDMETHODIMP CLBarItemButtonBase::GetInfo(TF_LANGBARITEMINFO *pInfo) +{ + return CLBarItemBase::GetInfo(pInfo); +} + +STDMETHODIMP CLBarItemButtonBase::GetStatus(DWORD *pdwStatus) +{ + return CLBarItemBase::GetStatus(pdwStatus); +} + +STDMETHODIMP CLBarItemButtonBase::Show(BOOL fShow) +{ + return CLBarItemBase::Show(fShow); +} + +STDMETHODIMP CLBarItemButtonBase::GetTooltipString(BSTR *pbstrToolTip) +{ + return CLBarItemBase::GetTooltipString(pbstrToolTip); +} + +STDMETHODIMP CLBarItemButtonBase::AdviseSink( + REFIID riid, + IUnknown *punk, + DWORD *pdwCookie) +{ + return CLBarItemBase::AdviseSink(riid, punk, pdwCookie); +} + +STDMETHODIMP CLBarItemButtonBase::UnadviseSink(DWORD dwCookie) +{ + return CLBarItemBase::UnadviseSink(dwCookie); +} + /*********************************************************************** * GetLibTls (MSUTB.@) *
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSUTB] Add CUTBLBarMenu (#6445)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8bfebdf444d96337429a0…
commit 8bfebdf444d96337429a01cdf4a92711f39b4c91 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Feb 6 13:34:34 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Feb 6 13:34:34 2024 +0900 [MSUTB] Add CUTBLBarMenu (#6445) Supporting Language Bar... JIRA issue: CORE-19363 - Implement CUTBLBarMenu class. --- dll/win32/msutb/msutb.cpp | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 4585ed7e6ca..4d988b4f26b 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -725,6 +725,39 @@ public: /***********************************************************************/ +class CUTBLBarMenuItem; + +class CUTBLBarMenu : public CCicLibMenu +{ +protected: + CUTBMenuWnd *m_pMenuUI; + HINSTANCE m_hInst; + +public: + CUTBLBarMenu(HINSTANCE hInst); + ~CUTBLBarMenu() override; + + CUTBMenuWnd *CreateMenuUI(); + INT ShowPopup(CUIFWindow *pWindow, POINT pt, LPCRECT prcExclude); + + STDMETHOD_(CCicLibMenuItem*, CreateMenuItem)() override; + STDMETHOD_(CCicLibMenu*, CreateSubMenu)() override; +}; + +/***********************************************************************/ + +class CUTBLBarMenuItem : public CCicLibMenuItem +{ +public: + CUTBLBarMenu *m_pLBarMenu; + +public: + CUTBLBarMenuItem() { m_pLBarMenu = NULL; } + BOOL InsertToUI(CUTBMenuWnd *pMenuUI); +}; + +/***********************************************************************/ + class CTrayIconWnd { protected: @@ -2500,6 +2533,92 @@ STDMETHODIMP CLBarItemBase::GetTooltipString(BSTR *pbstrToolTip) return bstr ? S_OK : E_OUTOFMEMORY; } +/*********************************************************************** + * CUTBLBarMenu + */ + +CUTBLBarMenu::CUTBLBarMenu(HINSTANCE hInst) : CCicLibMenu() +{ + m_hInst = hInst; +} + +CUTBLBarMenu::~CUTBLBarMenu() +{ +} + +STDMETHODIMP_(CCicLibMenuItem*) CUTBLBarMenu::CreateMenuItem() +{ + CUTBLBarMenuItem *pItem = new(cicNoThrow) CUTBLBarMenuItem(); + if (!pItem) + return NULL; + pItem->m_pLBarMenu = this; + return pItem; +} + +CUTBMenuWnd *CUTBLBarMenu::CreateMenuUI() +{ + CUTBMenuWnd *pMenuUI = new(cicNoThrow) CUTBMenuWnd(m_hInst, g_dwMenuStyle, 0); + if (!pMenuUI) + return NULL; + + pMenuUI->Initialize(); + for (size_t iItem = 0; iItem < m_MenuItems.size(); ++iItem) + { + CUTBLBarMenuItem *pItem = (CUTBLBarMenuItem *)m_MenuItems[iItem]; + pItem->InsertToUI(pMenuUI); + } + + return pMenuUI; +} + +STDMETHODIMP_(CCicLibMenu*) CUTBLBarMenu::CreateSubMenu() +{ + return new(cicNoThrow) CUTBLBarMenu(m_hInst); +} + +INT CUTBLBarMenu::ShowPopup(CUIFWindow *pWindow, POINT pt, LPCRECT prcExclude) +{ + if (m_pMenuUI) + return 0; + + m_pMenuUI = CreateMenuUI(); + if (!m_pMenuUI) + return -1; + + INT nCommandId = m_pMenuUI->ShowModalPopup(pWindow, prcExclude, TRUE); + + if (m_pMenuUI) + { + delete m_pMenuUI; + m_pMenuUI = NULL; + } + + return nCommandId; +} + +/*********************************************************************** + * CUTBLBarMenuItem + */ + +/// @unimplemented +BOOL CUTBLBarMenuItem::InsertToUI(CUTBMenuWnd *pMenuUI) +{ + if ((m_dwFlags & 4) != 0) + { + pMenuUI->InsertSeparator(); + return TRUE; + } + if (m_dwFlags & 2) + { + //FIXME + } + else + { + //FIXME + } + return FALSE; +} + /*********************************************************************** * GetLibTls (MSUTB.@) *
10 months, 3 weeks
1
0
0
0
[reactos] 01/01: [MSUTB][SDK] Add CLBarItemBase (#6444)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=34705d1a5de6be58132c3…
commit 34705d1a5de6be58132c38e73d2b7ba3a3154b13 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Feb 6 12:21:46 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Feb 6 12:21:46 2024 +0900 [MSUTB][SDK] Add CLBarItemBase (#6444) Supporting Language Bar... JIRA issue: CORE-19363 - Implement CLBarItemBase class. - Add TF_E_... flags to "msctf.idl". --- dll/win32/msutb/msutb.cpp | 138 +++++++++++++++++++++++++++++++++++++++++++++ sdk/include/psdk/msctf.idl | 26 +++++++-- 2 files changed, 160 insertions(+), 4 deletions(-) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 1a8ee45cc03..4585ed7e6ca 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -830,6 +830,40 @@ public: STDMETHOD_(BOOL, OnDelayMsg)(UINT uMsg) override; }; +/***********************************************************************/ + +class CLBarItemBase : public ITfLangBarItem +{ +protected: + DWORD m_dwItemStatus; + TF_LANGBARITEMINFO m_NewUIInfo; + WCHAR m_szToolTipText[256]; + LONG m_cRefs; + ITfLangBarItemSink *m_pLangBarItemSink; + +public: + CLBarItemBase(); + virtual ~CLBarItemBase(); + + HRESULT ShowInternal(BOOL bShow, BOOL bUpdate); + + void InitNuiInfo( + REFIID clsidService, + REFGUID guidItem, + DWORD dwStyle, + DWORD ulSort, + LPCWSTR Source); + + HRESULT AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie); + HRESULT UnadviseSink(DWORD dwCookie); + + // ITfLangBarItem methods + STDMETHOD(GetInfo)(TF_LANGBARITEMINFO *pInfo) override; + STDMETHOD(GetStatus)(DWORD *pdwStatus) override; + STDMETHOD(Show)(BOOL fShow) override; + STDMETHOD(GetTooltipString)(BSTR *pbstrToolTip) override; +}; + /*********************************************************************** * CUTBLangBarDlg */ @@ -2362,6 +2396,110 @@ CTrayIconWnd::_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } +/*********************************************************************** + * CLBarItemBase + */ + +CLBarItemBase::CLBarItemBase() +{ + m_dwItemStatus = 0; + m_szToolTipText[0] = 0; + m_cRefs = 1; + m_pLangBarItemSink = NULL; +} + +CLBarItemBase::~CLBarItemBase() +{ + if (m_pLangBarItemSink) + m_pLangBarItemSink->Release(); +} + +HRESULT +CLBarItemBase::AdviseSink( + REFIID riid, + IUnknown *punk, + DWORD *pdwCookie) +{ + if (IsEqualIID(riid, IID_ITfLangBarItemSink) || m_pLangBarItemSink) + return TF_E_NOOBJECT; + + HRESULT hr = punk->QueryInterface(IID_ITfLangBarItemSink, (void **)&m_pLangBarItemSink); + if (SUCCEEDED(hr)) + *pdwCookie = 0x80000001; + return hr; +} + +HRESULT CLBarItemBase::UnadviseSink(DWORD dwCookie) +{ + if (dwCookie != 0x80000001) + return E_FAIL; + + if (!m_pLangBarItemSink) + return E_UNEXPECTED; + + m_pLangBarItemSink->Release(); + m_pLangBarItemSink = NULL; + return S_OK; +} + +void +CLBarItemBase::InitNuiInfo( + REFIID clsidService, + REFGUID guidItem, + DWORD dwStyle, + DWORD ulSort, + LPCWSTR Source) +{ + m_NewUIInfo.clsidService = clsidService; + m_NewUIInfo.guidItem = guidItem; + m_NewUIInfo.dwStyle = dwStyle; + m_NewUIInfo.ulSort = ulSort; + StringCchCopyW(m_NewUIInfo.szDescription, _countof(m_NewUIInfo.szDescription), Source); +} + +HRESULT +CLBarItemBase::ShowInternal(BOOL bShow, BOOL bUpdate) +{ + DWORD dwOldStatus = m_dwItemStatus; + if (bShow) + m_dwItemStatus &= ~0x1; + else + m_dwItemStatus |= 0x1; + if (bUpdate && (dwOldStatus != m_dwItemStatus)) + { + if (m_pLangBarItemSink) + m_pLangBarItemSink->OnUpdate(TF_LBI_STATUS); + } + + return S_OK; +} + +STDMETHODIMP CLBarItemBase::GetInfo(TF_LANGBARITEMINFO *pInfo) +{ + CopyMemory(pInfo, &m_NewUIInfo, sizeof(*pInfo)); + return S_OK; +} + +STDMETHODIMP CLBarItemBase::GetStatus(DWORD *pdwStatus) +{ + *pdwStatus = m_dwItemStatus; + return S_OK; +} + +STDMETHODIMP CLBarItemBase::Show(BOOL fShow) +{ + return ShowInternal(fShow, TRUE); +} + +STDMETHODIMP CLBarItemBase::GetTooltipString(BSTR *pbstrToolTip) +{ + if (!pbstrToolTip) + return E_INVALIDARG; + BSTR bstr = ::SysAllocString(m_szToolTipText); + *pbstrToolTip = bstr; + return bstr ? S_OK : E_OUTOFMEMORY; +} + /*********************************************************************** * GetLibTls (MSUTB.@) * diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index c9cc9908474..748787fb795 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -23,10 +23,28 @@ import "textstor.idl"; import "ctfutb.idl"; #endif -cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)") -cpp_quote("#define TF_E_DISCONNECTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0504)") -cpp_quote("#define TF_E_ALREADY_EXISTS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)") -cpp_quote("#define TF_E_NOLOCK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)") +cpp_quote("#define TF_E_ALREADY_EXISTS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)") +cpp_quote("#define TF_E_COMPOSITION_REJECTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0508)") +cpp_quote("#define TF_E_DISCONNECTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0504)") +cpp_quote("#define TF_E_EMPTYCONTEXT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0509)") +cpp_quote("#define TF_E_FORMAT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x020A)") +cpp_quote("#define TF_E_INVALIDPOINT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0207)") +cpp_quote("#define TF_E_INVALIDPOS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0200)") +cpp_quote("#define TF_E_INVALIDVIEW MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0505)") +cpp_quote("#define TF_E_LOCKED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0500)") +cpp_quote("#define TF_E_NOINTERFACE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0204)") +cpp_quote("#define TF_E_NOLAYOUT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0206)") +cpp_quote("#define TF_E_NOLOCK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)") +cpp_quote("#define TF_E_NOOBJECT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0202)") +cpp_quote("#define TF_E_NOPROVIDER MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0503)") +cpp_quote("#define TF_E_NOSELECTION MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0205)") +cpp_quote("#define TF_E_NOSERVICE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0203)") +cpp_quote("#define TF_E_NOTOWNEDRANGE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0502)") +cpp_quote("#define TF_E_RANGE_NOT_COVERED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0507)") +cpp_quote("#define TF_E_READONLY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0209)") +cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)") +cpp_quote("#define TF_E_SYNCHRONOUS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0208)") +cpp_quote("#define TF_S_ASYNC MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0x0300)") cpp_quote("EXTERN_C HRESULT WINAPI TF_InitSystem(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_UninitSystem(VOID);")
10 months, 3 weeks
1
0
0
0
[reactos] 03/03: [NTOS:PO] Set SystemBatteriesPresent when having a battery device in the system
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9e43518da596d23b78d33…
commit 9e43518da596d23b78d33f38d23900a5f8ff9dd9 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Thu Feb 1 22:40:22 2024 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Mon Feb 5 18:04:02 2024 +0100 [NTOS:PO] Set SystemBatteriesPresent when having a battery device in the system This is (at least) used by powercfg.cpl to know if it needs to display some additional pages. --- ntoskrnl/po/events.c | 7 +++++++ ntoskrnl/po/power.c | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ntoskrnl/po/events.c b/ntoskrnl/po/events.c index 0db341a6ffa..98be49b06e1 100644 --- a/ntoskrnl/po/events.c +++ b/ntoskrnl/po/events.c @@ -159,6 +159,7 @@ PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure, BOOLEAN Arrival; ULONG Caps; NTSTATUS Status; + POP_POLICY_DEVICE_TYPE DeviceType = (POP_POLICY_DEVICE_TYPE)(ULONG_PTR)Context; DPRINT("PopAddRemoveSysCapsCallback(%p %p)\n", NotificationStructure, Context); @@ -175,6 +176,12 @@ PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure, else return STATUS_INVALID_PARAMETER; + if (Arrival && DeviceType == PolicyDeviceBattery) + { + PopCapabilities.SystemBatteriesPresent = TRUE; + return STATUS_SUCCESS; + } + if (Arrival) { DPRINT("Arrival of %wZ\n", Notification->SymbolicLinkName); diff --git a/ntoskrnl/po/power.c b/ntoskrnl/po/power.c index b7143b441d3..8a6df8a4195 100644 --- a/ntoskrnl/po/power.c +++ b/ntoskrnl/po/power.c @@ -423,6 +423,18 @@ PoInitSystem(IN ULONG BootPhase) PopAddRemoveSysCapsCallback, (PVOID)(ULONG_PTR)PolicyDeviceSystemButton, &NotificationEntry); + if (!NT_SUCCESS(Status)) + return FALSE; + + /* Register battery notification */ + Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, + PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, + (PVOID)&GUID_DEVICE_BATTERY, + IopRootDeviceNode->PhysicalDeviceObject->DriverObject, + PopAddRemoveSysCapsCallback, + (PVOID)(ULONG_PTR)PolicyDeviceBattery, + &NotificationEntry); + return NT_SUCCESS(Status); } @@ -824,7 +836,10 @@ NtPowerInformation(IN POWER_INFORMATION_LEVEL PowerInformationLevel, /* Just zero the struct (and thus set BatteryState->BatteryPresent = FALSE) */ RtlZeroMemory(BatteryState, sizeof(SYSTEM_BATTERY_STATE)); BatteryState->EstimatedTime = MAXULONG; + BatteryState->BatteryPresent = PopCapabilities.SystemBatteriesPresent; // BatteryState->AcOnLine = TRUE; +// BatteryState->MaxCapacity = ; +// BatteryState->RemainingCapacity = ; Status = STATUS_SUCCESS; }
10 months, 3 weeks
1
0
0
0
← Newer
1
...
9
10
11
12
13
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
Results per page:
10
25
50
100
200